Date post: | 07-Aug-2015 |
Category: |
Technology |
Upload: | drupalcamp-msk |
View: | 128 times |
Download: | 1 times |
S
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
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
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)
Tokens
Expose your module information to other modules
Examples HybridAuth and uLogin modules use it to expose
social information
Rules
Rules are ruling
Power and flexibility
Examples HybridAuth and uLogin Yandex Webmaster Original Texts
Views Bulk Operations
Batch API
Queue
Very useful for content manipulations
You just need to code the actual changes
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
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
What a plugin is?
Array of properties utilized by another module
Properties may be function callbacks
S
Most popular content
Module design example
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?
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