Professional Documents
Culture Documents
Outline
What is the problem? The Theming Process The Render Array Cases: Swap between regions Hacking the node Re-ordering, inserting
2
www.wizzlern.nl @wizzlern
3
Move a node link to the top of the node or to the site-bar. E.g. Tell a friend link
Parents knows little of their children Children know little of their parent (context) Siblings dont know each other at all.
8
10
11
12
http://www.funnyanimalpictures.net
13
14
15
Disadvantages of the RA
It is soo complex. It still requires lots of PHP knowledge. It potentially violates the MVC/PAC model.
16
Your RA experiences?
17
18
ch nt Do
ge an ge an
Description
ch nt Do
<div class="report"> <div class="report-file"><a href="http://...">Report ...</a></div> <div class="report-meta"><span class="icon pdf">PDF document</span> | 154 KB<br />Report | 21-03-2011 | Min EL&I</div> </div>
19
20
21
22
23
Render process
Traversing down from the page to the 'leaves'.
hook_page_build() // Last call to modules to ADD items to the page array. hook_page_alter() // For both modules and themes to alter the page array. THEME_preprocess_page() // $variables['page'] holds page render array + children THEME_process_page() // Every preprocess is followed by a process function. page.tpl.php THEME_preprocess_node() // $variables['content'] holds node render array + children node.tpl.php // Next: comment-wrapper, comment, etc.
24
drupal_render()
#type = set of default properties #theme = theme function. Render children too. #prex, #sufx = wrapped around HTML result. More details of #properties in FAPI docs.
25
26
Usefull RA properties
#weight : Determines the sort order. #sorted : If FALSE forces sorting. #print : If TRUE element is not rendered. Better: use hide(), show(). #attached : Attach CSS and JS to the element. #state : JS without JS. #prex, #sufx : Element pre- and sufx HTML
27
28
Summary
29
Summary
Problems: Vertical stack, Content awareness Solutions: Render Array, hook_page_alter(), *_preprocess_*() render(), show(), hide() #weight, #prex, #sufx, #state
30
31
www.wizzlern.nl
This work is licensed under a Creative Commons Attribution 3.0 Unported License.