Developing for the Views 7.3 API Frédéric G. MARAND   aka  fgm  aka  OSInet
Session summary Concepts
Basic integration: default views & embedding
Drupal-style integration: lifecycle hooks
Views-style integration: handlers & plugins
Going further
1. Concepts
Concepts: Is this for you ? Views UI
PHP5 OOP
Module development
Concepts: Views API, why care ? Code-based views
Views-based code
Views theming
Extra view types
Concepts: Why care ? More extras Handlers... Area contents
Argument types
Field types
Filters
Relationships
Sort rules Plugins... Access controls
Argument defaults
Argument validators
Caching mechanisms
Exposed forms
Localization
Pager types
Query engines
Layouts
Concepts: I'm sold: what is a View ? A pre-built query SQL, NoSQL, WS...
From Views UI or from code
On known entities ....
.... not in the EFQ sense
Concepts: What is a View, again ? A parametric query Arguments
Exposed filters A query with formatted results Layout plugins: Display, Style, Row
Themable
Yes, it means a   REPORT
Concepts: a report for coders The « exportable » concept Default views
Normal views
Overridden views Features, anyone ?
Concepts: enough talk Time for some  <?php hooks(); ?>
2. Basic default/embed
Basic: Hello, Views hook_views_api() Version matching
Component location
THE hook in your module
Basic: HVA demo (Switch to code view)
Basic:  intermezzo Intermezzo: hooks & OO  in Views Skip to HVD
Basic: hooks & OO in Views Hooks
Passive observer pattern

Drupal Views development

Editor's Notes

  • #5 If you don&apos;t know Views UI, you will have a hard time understanding what all of this is about. If you don&apos;t know the basics of (PHP5) OOP, Views-style integration will look hairy. If you aren&apos;t used to module development, you will have a hard time understand why devs care about this.
  • #8 Examples: - Flickr query plugin, - MongoDB Views integration Not EFQ query plugin including, but exists in contrib
  • #9 Meaning it can be used in different places, or take input from the context, like the URL, or from the user Themability: the SemanticViews case So basically Views is a report builder. Just like Crystal Reports, but for Drupal. No (good) printing solutions.
  • #10 Views introduced the concept early in Drupal, and it really caught the Drupal dev world with Drupal 6. This is really what Features is about But Features&apos; Views integration, alas...
  • #13 So you wanna talk to Views, eh ? Start by saying hello Other hook implementations will go elsewhere thanks to it.
  • #14 Check: dr713.info dependencies[] = views dr713.module HVA
  • #15 Skip if later than T0 + 15 minutes
  • #17 Miscellany views_many_to_one_helper views_tab views_tabset views_join views_join_complex
  • #20 Views invokes these hooks only when the cache has been deleted. This being configuration information, it needn&apos;t be recomputed constantly.
  • #22 Domain Specific Language: not /that/ true, but the idea comes from seeing similar constructs usually be done with INI, XML or JSON files, whereas Views uses format to skip on the user-space parsing logic PHPTemplate vs Xtemplate, PHPTal, Smarty... Also CCK content types And, of course Features / Ctools exportables
  • #31 Actually, area handlers are really much like field handlers, so they contribute to the query in some abstract sense (although not technically)
  • #35 Why ? Arguments themselves translate to conditions in the query. Defaults and validation do not translate to the query itself, but can inject parameters or prevent the query from being ran. views_content_cache attempts to invalidate content depending on actual activity, like comment/node updates and VotingAPI
  • #39 Sample problem-space ordering: partial IPv4 addresses - not number: must be left aligned - not string Sample problem-space filtering - filter on month of date
  • #42 This is not what actually happens in code, but it simpler to figure out that way.