The morning sessions of the Drupalcamp at Stanford is over and I am rushing to write it up before the afternoon sessions are starting.
First I attended Harris Rashid’s (another Chapter Three employee) “Theme preprocess functions in template.php” session about “How to intercepts data coming from core and modules and customize them for your own needs.”
- It was a very hands on session, going through customizing both a node.php and template.php and deconstructing the $content variable
- Started off with Acquia Prospero theme.
- Tools used: devel module, admin module, firebug, “Basic” theme (started, based on the Zen theme)
- Example: Overriding: $submitted in template.php
– look for “theme_node_submitted” function in node.module
– copy the function from there to template.php and change it
- Always override, never change a core module
- Use dpm($vars) (drupal print message) from the “Devel module” that prints out the all the variable what’s available in node
- http://api.drupal.org/api/function/check_plain – useful to sanitize content coming from users
- There was much more, but without I didn’t manage to copy the code form screen and without that it doesn’t make much sense to post more here.
The second session I attended this morning was Sean Lange‘s “Using Panels to Make Smarter Pages” One of these days I will just need to sit down and play with Panels myself. Till then it doesn’t make much sense to make notes of the steps involved. Instead I just mention some highlights that I want to remember for the future.
- An older version of Sean’s slides are available both from the Drupalcamp site and from his own at seanlange.com.
- His professional site also has good content: http://webthingee.com/
- We went through creating panels for his imaginary “Heroes of Badcamp” site.
- Use “selection rules” for defining what type of nodes should have the panes specified.
- Different panels are called “variants.” Drupal follows them in order: the first one on the appropriate list is executed.
- Advantage of having a panel with a single pane: if users click the “edit” button, they can edit only the top part. The dynamic or view part under it is left untouched.
- “Draggable views” implements a weighing system, making “rows of a view “draggable” which means that they can be rearranged by Drag’n’Drop” by the users.
- Each pane can have a visibility rule, by user role and/or node type.
- The biggest evolution for Panels in Drupal 7 is “In-place editing”
- We didn’t get to what I’d call “smarter” pages, but I still learned a lot of new functionality.