Skip to content


Subversion checkout URL

You can clone with
Download ZIP
100644 104 lines (79 sloc) 4.54 KB
3557937 @cotto temp. commit of notes for views
1 drupalcon 2012
2 alice in wonderland of fields and entities
3 karen stevenson
5 will talk abtou lots of modules, not all are safe for production use
6 best analog to entities is alice in wonderland
8 in te beginning, the Story module.
9 needed to write code if you watned to have other fields (recommended path: copy/paste code, rename, etc)
10 next, flexinode, which took off way beyond expectation
11 in 4.7, enter CCK with custom content ttypes and fields, all through an nice ui (well, not nice)
12 when you have a hammer... (becasue everything could be a node and nodes were flexible)
13 around 5, 6 custom content types went into core.
15 everything isn't actually a noce, but everything needs fields (users, comments, etc)
16 in 7, cck is now in core and we only need the entity api (have fields in core, custom contet types, entities)
19 SKIP, go to views talk
20 views for developers
21 bevan rudge
23 custom code sucks. you have to maintain it, upgrade, it'll be buggy for a while, etc
24 "before you extend, can you bend?"
25 the more config you know, the lesscode you need
57deb29 @cotto part 1 of the views talk
27 anayomy ofa view: (note to reader: find diagram if possible)
3557937 @cotto temp. commit of notes for views
28 top level: title, display (display: header area: area plugin) exposed filters, attachments (before)
29 rows (row: entity OR field, field, ...) OR empty area (empty area: area plugin)
30 pager, attachments (after) (footer area: area plugin), feed icons
32 view3 lets you configure the eleemnt that wraps the field (v2 + semantic views)
33 also does "provide default field wrapper elements" under style options
57deb29 @cotto part 1 of the views talk
35 other feature: field concatenation
36 "rewrite the output of this field"
37 feature: render field as link
39 and/or filters: new in views3, same as views OR but nicer
40 it's not in the ui, but you can OR together contextual filters
41 (the filters end up in the WHERE clause)
43 result summaries/oager summaries
44 "displaying 1-7 of 7"
45 area plugin
47 aggregate/count queries
48 prepreq is to be able to debug the sql, because it's complicated
49 also v. powerful
50 enable "use aggregation" -> "aggregation settings", "COUNT(...)"
52 alternate pagers: date, alphabetical, glossary
53 page: pager option does this
54 ussually use a contextual filter
56 views link area (views_linkarea contrib module)
57 exposes area plugin to add a link
59 review: look for simple solutions, don't write custom code
60 anayomy of a view, custom markup for fields, field concat, fields as custom links, no results behavior for fields and summary views.
61 and/or config for filters, contextual filters, results ummaries, agg/count queries, date/etc-based pagers, link are module
6936e49 @cotto part 2 of views talk
63 part 2: add new and custom feature
64 writing nasty custom code that'll cost us so much time and money
65 docs: api.d.o/api/views/groups (topical and api)
66 doxygen: (updated for views 3)
68 ususally you'll need to create something that inherits from something, so doxygen helps you there
70 building a views module:
71 step 1: hook_views_api - where are your fiels, what version of the views api are you working against
72 step 2: create a subclass of the appropriate class (for linkarea, subclass views_handler_area)
73 look for an exisnting module or class that does something like what you need
74 step 3: expose the class/include file to the .info file (for d7)
75 step 4: expose class via hook_views_data - how the class integrates with the data schema (might need a pseudo-column)
77 how classes relate to features in the ui
78 views_handler_field - subclasses expose fields
79 viewsw_handler_arg - for contextual filters
80 views_handler_relationshiup - parent to clases that add relationship
81 views_handler_area - stuff that goes in the header, footer and no results
82 views_plugin_display - different Views displays (attachment, block, default, page, feed, etc)
83 views_plugin_style - formatter otpions (html list, for, rss, ...)
84 views_plugin_row - how a row gets formamter
85 v_p_pager - paging
86 v_p_access - usually unneeded, nice for subclassing if needed
87 vies_plugin_argument_default - when contextual filter looks somewhere other than the url for an arg
88 views_plugin_arg_validate - what should the arg look like
90 review: docs, oo hierarchy, example of views_linkarea, what classes are analogous to whcih config options
57deb29 @cotto part 1 of the views talk
21c51f3 @cotto add the questions I felt like capturing
92 q1: how to use remote data
93 extend views_plugin_query, likely someone's already done it
94 entity-layer would mean duplicating data
96 q2: what happens when hook_views_api specifies 3.0-alpha1 and you're on 3.0
97 a: idk. check the docs. probably something sane
99 q3: view can have multiple handlers, but must have exactly one plugin
100 handler for dispalying data, plugin for gettting it
102 q4: how to migrate from 6 to 7
103 d7 only has views3, need to upgrade in d6, probably need to manually rebuild
Something went wrong with that request. Please try again.