Your SlideShare is downloading. ×
Views for hackers
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.


Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Views for hackers


Published on

Overview of Views programming for Drupal developers. Presented at Pacific Northwest Drupal Summit, Vancouver 2010. …

Overview of Views programming for Drupal developers. Presented at Pacific Northwest Drupal Summit, Vancouver 2010.

There's a module for that!

1 Like
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. VIEWS for HACKERS an overview of Views programming Karim Ratib (infojunkie@drupal) There's a module for that!
  • 2. OUTLINE CONTEXT problem trivia   ARCHITECTURE overview  file structure workflow components  hooks functions   EXAMPLES from views.module and other contrib modules
  • 3. CONTEXT // problem coding node lists is boring coding node lists with filters is boring +1 coding node lists with different themes is boring +10 ... merlinofchaos chose to code all this for us!
  • 4. CONTEXT // trivia
      • First checkin: Fri Nov 25 20:33:09 2005 UTC (4 years, 10 months ago) by merlinofchaos
      • Lines of code: 95K+
       wc -l `find ./ -type f`    
      • 3rd party sub-modules: 160+  
      • 5.
      •   Usage
           235K          Drupal       343K       CCK       217K  
  • 6. ARCHITECTURE // overview SELECT n.title, fields FROM {node} n base table INNER JOIN {users} u ON n.uid = u.uid relationship WHERE n.status = 1 filters hook_menu() : nodes/list display (page) theme('item_list', $results); style (list)
  • 7. ARCHITECTURE // file structure views / Drupal façade     ./includes core: view, query, utilities, base classes     ./handlers SQL add-ons: fields, filters, arguments,                                    relationships, sort      ./plugins non-SQL add-ons: display, style, row,                                  arg default, arg validator, access, cache, query (3.x), exposed form (3.x), pager (3.x)      ./theme theme and preprocessor files      ./modules data models + specialized handlers          ./node         ./user         ./taxonomy ...
  • 8. ARCHITECTURE // workflow BUILD init components, get arguments, generate SQL view::build() EXECUTE execute SQL, store results view::execute() RENDER execute theme functions view::render()
  • 9. ARCHITECTURE // components // 1 containment relationships
  • 10. ARCHITECTURE // components // 2 plugin type relationships
  • 11. ARCHITECTURE // components // 3 handler type relationships
  • 12. ARCHITECTURE // hooks docs/docs.php grep -Er 'module_|drupal_alter' * hook_views_api() hook_views_default_views(), _alter() hook_views_pre_view() hook_views_pre_build() hook_views_pre_execute() hook_views_pre_render() hook_views_post_render() hook_views_query_alter() hook_views_query_substitutions() hook_views_analyze() hook_views_plugins(), _alter() hook_views_handlers() hook_views_convert() hook_views_data(), _alter() hook_views_exportables() hook_views_preview_info_alter() hook_views_tabset_alter() hook_views_admin_links_alter() hook_ajax_data_alter()
  • 13. ARCHITECTURE // functions views_get_view() load object by id or name views_get_view_result() execute to array views_embed_view() render to string
  • 14. EXAMPLES style plugin base type and data model field handler filter handler exposed filter summary style plugin access plugin
  • 15. Karim Ratib (infojunkie@drupal) There's a module for that! http://there is a module for Thank you!