best practices in drupal 7 (views, panels ...)
DESCRIPTION
How to increase the performance on you site?TRANSCRIPT
![Page 1: Best practices in Drupal 7 (Views, Panels ...)](https://reader031.vdocuments.us/reader031/viewer/2022013110/53f91aec8d7f7253318b4a83/html5/thumbnails/1.jpg)
Views & Panels
![Page 2: Best practices in Drupal 7 (Views, Panels ...)](https://reader031.vdocuments.us/reader031/viewer/2022013110/53f91aec8d7f7253318b4a83/html5/thumbnails/2.jpg)
Sergiu Savva
Drupal Developer for 3 Years
Drupal user https://drupal.org/user/1758280LinkedIn profile http://lnkd.in/i9J7aSFacebook page http://www.facebook.com/Gamer4ik
![Page 3: Best practices in Drupal 7 (Views, Panels ...)](https://reader031.vdocuments.us/reader031/viewer/2022013110/53f91aec8d7f7253318b4a83/html5/thumbnails/3.jpg)
Broken windows theory
![Page 4: Best practices in Drupal 7 (Views, Panels ...)](https://reader031.vdocuments.us/reader031/viewer/2022013110/53f91aec8d7f7253318b4a83/html5/thumbnails/4.jpg)
![Page 5: Best practices in Drupal 7 (Views, Panels ...)](https://reader031.vdocuments.us/reader031/viewer/2022013110/53f91aec8d7f7253318b4a83/html5/thumbnails/5.jpg)
![Page 6: Best practices in Drupal 7 (Views, Panels ...)](https://reader031.vdocuments.us/reader031/viewer/2022013110/53f91aec8d7f7253318b4a83/html5/thumbnails/6.jpg)
Views
![Page 7: Best practices in Drupal 7 (Views, Panels ...)](https://reader031.vdocuments.us/reader031/viewer/2022013110/53f91aec8d7f7253318b4a83/html5/thumbnails/7.jpg)
Views Execute order
http://www.kdweb.co.uk/blog/drupal-module-views-hook-sequence
hook_views_pre_view (&$view)⇓
hook_views_pre_build (&$view)⇓
hook_views_query_alter (&$view, &$query)⇓
hook_views_pre_execute (&$view)⇓
hook_views_pre_render (&$view)⇓
hook_views_post_render (&$view)
![Page 8: Best practices in Drupal 7 (Views, Panels ...)](https://reader031.vdocuments.us/reader031/viewer/2022013110/53f91aec8d7f7253318b4a83/html5/thumbnails/8.jpg)
Fields excludesViews
![Page 9: Best practices in Drupal 7 (Views, Panels ...)](https://reader031.vdocuments.us/reader031/viewer/2022013110/53f91aec8d7f7253318b4a83/html5/thumbnails/9.jpg)
Fields excludesViews
![Page 10: Best practices in Drupal 7 (Views, Panels ...)](https://reader031.vdocuments.us/reader031/viewer/2022013110/53f91aec8d7f7253318b4a83/html5/thumbnails/10.jpg)
Views Custom text
![Page 11: Best practices in Drupal 7 (Views, Panels ...)](https://reader031.vdocuments.us/reader031/viewer/2022013110/53f91aec8d7f7253318b4a83/html5/thumbnails/11.jpg)
![Page 12: Best practices in Drupal 7 (Views, Panels ...)](https://reader031.vdocuments.us/reader031/viewer/2022013110/53f91aec8d7f7253318b4a83/html5/thumbnails/12.jpg)
![Page 13: Best practices in Drupal 7 (Views, Panels ...)](https://reader031.vdocuments.us/reader031/viewer/2022013110/53f91aec8d7f7253318b4a83/html5/thumbnails/13.jpg)
Views Alternatives
Panel fields
Display mode (node, comment, entity … )
VS
![Page 14: Best practices in Drupal 7 (Views, Panels ...)](https://reader031.vdocuments.us/reader031/viewer/2022013110/53f91aec8d7f7253318b4a83/html5/thumbnails/14.jpg)
Views Display mode
![Page 15: Best practices in Drupal 7 (Views, Panels ...)](https://reader031.vdocuments.us/reader031/viewer/2022013110/53f91aec8d7f7253318b4a83/html5/thumbnails/15.jpg)
Views Additional tools
![Page 16: Best practices in Drupal 7 (Views, Panels ...)](https://reader031.vdocuments.us/reader031/viewer/2022013110/53f91aec8d7f7253318b4a83/html5/thumbnails/16.jpg)
Entity View ModeViews Additional tools
![Page 17: Best practices in Drupal 7 (Views, Panels ...)](https://reader031.vdocuments.us/reader031/viewer/2022013110/53f91aec8d7f7253318b4a83/html5/thumbnails/17.jpg)
hook_field_extra_fields()Fields Additional tools
/** * Implements hook_field_extra_fields(). */function HOOK_field_extra_fields() {
$extrafield_name = 'my_field';
foreach (array('page', 'article') as $node_type) {
$extra['node'][$node_type]['display'][$extrafield_name] = array(
'label' => t('Some freaking title'),
'description' => t('A serious description.'),
'weight' => 50, // default weight, can be changed on display form by site-builder.
); } return $extra; }
http://www.vdmi.nl/blog/attach-extra-or-pseudo-fields-any-entity-drupal
![Page 18: Best practices in Drupal 7 (Views, Panels ...)](https://reader031.vdocuments.us/reader031/viewer/2022013110/53f91aec8d7f7253318b4a83/html5/thumbnails/18.jpg)
hook_node_view()Views Additional tools
/** * Implements hook_node_view(). * Also HOOK_entity_view() can be used. */
function HOOK_node_view($node, $view_mode, $langcode) {
$extrafields = field_extra_fields_get_display('node', $node->type, $view_mode);
$extrafield_name = 'my_field'; if (isset($extrafields[$extrafield_name]) && isset($extrafields[$extrafield_name]['visible']) && $extrafields[$extrafield_name]['visible']) {
// Your logic here.$node->content[$extrafield_name] = array('#markup' => 'Build array with content');
}}
http://www.vdmi.nl/blog/attach-extra-or-pseudo-fields-any-entity-drupal
![Page 19: Best practices in Drupal 7 (Views, Panels ...)](https://reader031.vdocuments.us/reader031/viewer/2022013110/53f91aec8d7f7253318b4a83/html5/thumbnails/19.jpg)
Views Additional toolsViews pane field
![Page 20: Best practices in Drupal 7 (Views, Panels ...)](https://reader031.vdocuments.us/reader031/viewer/2022013110/53f91aec8d7f7253318b4a83/html5/thumbnails/20.jpg)
Views & Panels Custom layout
Panels 3: Creating a custom layout in your theme https://drupal.org/node/495654
; Panels layouts. You can place multiple layouts under the "layouts" folder.plugins[panels][layouts] = layouts
my_theme.info
$plugin = array( 'title' => t('One row two columns'), 'category' => t('onerowtwocols'), 'icon' => 'onerowtwocols.png', 'theme' => 'onerowtwocols', 'css' => 'onerowtwocols.css', 'regions' => array(
'top' => t('Top'),'right' => t('Right side'),'left' => t('Left side')
),);
my_plugin.inc
![Page 21: Best practices in Drupal 7 (Views, Panels ...)](https://reader031.vdocuments.us/reader031/viewer/2022013110/53f91aec8d7f7253318b4a83/html5/thumbnails/21.jpg)
Views & Panels Overloaded Pages
(Views == listing) == TRUE
(Views != one node) == TRUE
![Page 22: Best practices in Drupal 7 (Views, Panels ...)](https://reader031.vdocuments.us/reader031/viewer/2022013110/53f91aec8d7f7253318b4a83/html5/thumbnails/22.jpg)
Views & Panels Overloaded Pages
![Page 23: Best practices in Drupal 7 (Views, Panels ...)](https://reader031.vdocuments.us/reader031/viewer/2022013110/53f91aec8d7f7253318b4a83/html5/thumbnails/23.jpg)
Views & Panels SQL in template files
Do not use SQL in template files
![Page 24: Best practices in Drupal 7 (Views, Panels ...)](https://reader031.vdocuments.us/reader031/viewer/2022013110/53f91aec8d7f7253318b4a83/html5/thumbnails/24.jpg)
![Page 25: Best practices in Drupal 7 (Views, Panels ...)](https://reader031.vdocuments.us/reader031/viewer/2022013110/53f91aec8d7f7253318b4a83/html5/thumbnails/25.jpg)
Views Fields handler
![Page 26: Best practices in Drupal 7 (Views, Panels ...)](https://reader031.vdocuments.us/reader031/viewer/2022013110/53f91aec8d7f7253318b4a83/html5/thumbnails/26.jpg)
Panels
![Page 27: Best practices in Drupal 7 (Views, Panels ...)](https://reader031.vdocuments.us/reader031/viewer/2022013110/53f91aec8d7f7253318b4a83/html5/thumbnails/27.jpg)
block VS ctools content type plugins
![Page 28: Best practices in Drupal 7 (Views, Panels ...)](https://reader031.vdocuments.us/reader031/viewer/2022013110/53f91aec8d7f7253318b4a83/html5/thumbnails/28.jpg)
Views Panels, Why so slow?
![Page 29: Best practices in Drupal 7 (Views, Panels ...)](https://reader031.vdocuments.us/reader031/viewer/2022013110/53f91aec8d7f7253318b4a83/html5/thumbnails/29.jpg)
![Page 30: Best practices in Drupal 7 (Views, Panels ...)](https://reader031.vdocuments.us/reader031/viewer/2022013110/53f91aec8d7f7253318b4a83/html5/thumbnails/30.jpg)
![Page 31: Best practices in Drupal 7 (Views, Panels ...)](https://reader031.vdocuments.us/reader031/viewer/2022013110/53f91aec8d7f7253318b4a83/html5/thumbnails/31.jpg)
![Page 32: Best practices in Drupal 7 (Views, Panels ...)](https://reader031.vdocuments.us/reader031/viewer/2022013110/53f91aec8d7f7253318b4a83/html5/thumbnails/32.jpg)
Thank You !!