Views 3 for Developers

Printer-friendly versionPrinter-friendly version

(notes from a session at DrupalCon 2010)

presented by Larry Garfield (crell)

  • overview: how Views works
    • Views 3 is still alpha, so caveat emptor
    • a tool for making lists of things, not just content but anything, even data from external sources
    • all views are conceptually a spreadsheet, with fields being columns.
    • the "what" level: filters, arguments, fields, sorts, relations
    • the "how" layer: styles, row plugins, pager, new area handler
    • the "where" layer: display, access, exposed filter form
  • query structure overview
    • fields are SELECT, filters and arguments are WHERE, sorts are ORDER BY, relationships are JOINs
  • plugins vs. handlers
    • plugins are swappable components
    • types of plugins: themeable (display, style, row style, pager, exposed form) and non-themeable (access, arg default, arg validator, caching, query)
    • handler -- can be only one
  • live demo (in which something will go horribly wrong!)
    • example: Views Tree style plugin for displaying hierarchical structures
    • module calls views_tree_views_api() to declare itself to Views, then supporting functions to do the work
    • has been known to work with trees of hundreds of nodes up to 30 levels deep!
    • Views Link Area module is a handler, provides a "links" area for views similar to the one on nodes