Top Banner
S Hooks, tokens, rules, elements, plugins Developing for Drupal the “right” way “I know a way” (c) Saul Berrenson
15

Hooks, tokens, rules, elements, plugins Developing for Drupal the “right” way “I know a way” (c) Saul Berrenson.

Dec 28, 2015

Download

Documents

Angelina Casey
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Hooks, tokens, rules, elements, plugins Developing for Drupal the “right” way “I know a way” (c) Saul Berrenson.

S

Hooks, tokens, rules, elements, plugins

Developing for Drupal the “right” way“I know a way” (c) Saul Berrenson

Page 2: Hooks, tokens, rules, elements, plugins Developing for Drupal the “right” way “I know a way” (c) Saul Berrenson.

Who am I?

Head of Web-development for Axel Springer Russia

Author of 20+ contrib modules

Maintainer of several other contrib modules

Module application reviewer

Recently a father to a cute daughter Anastasia

Page 3: Hooks, tokens, rules, elements, plugins Developing for Drupal the “right” way “I know a way” (c) Saul Berrenson.

Plan first, code second

You should know the code flow before writing anything

Plan for flexible and light architecture

Think about exposed APIs your module would need

Page 4: Hooks, tokens, rules, elements, plugins Developing for Drupal the “right” way “I know a way” (c) Saul Berrenson.

Utilize Drupal’s best parts

Drupal is really good in text filtering, but only server-side (PHP code)

Paste Format uses Drupal text filtering features to filter the pasted text (and you rule what actually gets filtered and what stays in your content)

Page 5: Hooks, tokens, rules, elements, plugins Developing for Drupal the “right” way “I know a way” (c) Saul Berrenson.

Tokens

Expose your module information to other modules

Examples HybridAuth and uLogin modules use it to expose

social information

Page 6: Hooks, tokens, rules, elements, plugins Developing for Drupal the “right” way “I know a way” (c) Saul Berrenson.

Rules

Rules are ruling

Power and flexibility

Examples HybridAuth and uLogin Yandex Webmaster Original Texts

Page 7: Hooks, tokens, rules, elements, plugins Developing for Drupal the “right” way “I know a way” (c) Saul Berrenson.

Views Bulk Operations

Batch API

Queue

Very useful for content manipulations

You just need to code the actual changes

Page 8: Hooks, tokens, rules, elements, plugins Developing for Drupal the “right” way “I know a way” (c) Saul Berrenson.

Elements

Easy to reuse in any renderable array

#properties to control your element

Study drupal_render() to understand the rendering flow

‘#pre_render’ is really powerful

Page 9: Hooks, tokens, rules, elements, plugins Developing for Drupal the “right” way “I know a way” (c) Saul Berrenson.

Plugins

Views, Panels use it – and you should

Flexible architecture

Eases maintenance and support (Image Editor)

Allows other developers to extend your module

Drupal 8 does the same

Page 10: Hooks, tokens, rules, elements, plugins Developing for Drupal the “right” way “I know a way” (c) Saul Berrenson.

What a plugin is?

Array of properties utilized by another module

Properties may be function callbacks

Page 11: Hooks, tokens, rules, elements, plugins Developing for Drupal the “right” way “I know a way” (c) Saul Berrenson.

S

Most popular content

Module design example

Page 12: Hooks, tokens, rules, elements, plugins Developing for Drupal the “right” way “I know a way” (c) Saul Berrenson.

Most popular content

Always fresh statistics

By day, week, month

By content section on our site

No load on our servers

Is there a module for that?

Page 13: Hooks, tokens, rules, elements, plugins Developing for Drupal the “right” way “I know a way” (c) Saul Berrenson.
Page 14: Hooks, tokens, rules, elements, plugins Developing for Drupal the “right” way “I know a way” (c) Saul Berrenson.

Statistics provider

(plugins?)Popular URLs

URLs processor(plugins)

Popular entities(nodes, terms, you name it)

Views integration(Views handlers)

Any widget design

https://www.drupal.org/sandbox/chyvakoff/2370095

Page 15: Hooks, tokens, rules, elements, plugins Developing for Drupal the “right” way “I know a way” (c) Saul Berrenson.

Thank you!

[email protected]