Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
in reference to the following documentation for hook_page_alter :
// Node body.
$page['content']['nodes'][$nid]['body']
// Array of links attached to the node (add comments, read more).
$page['content']['nodes'][$nid]['links']
// The node object itself.
$page['content']['nodes'][$nid]['#node']
// The results pager.
$page['content']['pager']
Could the structure happen to be the following?
$page['content']['system_main']['nodes']...
Comment | File | Size | Author |
---|---|---|---|
#6 | 975806.patch | 933 bytes | amateescu |
#3 | screenshot_034.png | 5.68 KB | chx |
Comments
Comment #1
jhodgdonI don't know -- are you asking a question or saying the documentation is incorrect?
Comment #2
nlambert CreditAttribution: nlambert commentedI'm suggesting that the documentation might be incorrect. I believe the node structure might be :
$page['content']['system_main']['nodes']... etc
I stumbled onto this while "moving" the advanced search form to another block... (the search form being within the same array as the nodes)
function cdm_page_alter(&$page) {
if (arg(0) == 'search' && arg(2)) {
$page['title_region']['search_form'] = $page['content']['system_main']['search_form'];
unset($page['content']['system_main']['search_form']);
}
}
Comment #3
chx CreditAttribution: chx commentedThat's correct.
Comment #4
jhodgdonOK, thanks! The hook_page_alter() documentation needs to be updated then. This would be a good project for a novice doc/patch contributor.
Comment #5
nlambert CreditAttribution: nlambert commentedI'm fairly new to this :-)
I guess I can start by reading...
http://drupal.org/contribute/documentation
Comment #6
amateescu CreditAttribution: amateescu commentedThis should do it.
@modesia, I suggest you read this also: http://drupal.org/node/707484
Comment #7
jhodgdonLooks reasonable to me, given the screen shot chx gave and the suggestion from the person who reported this issue.
Comment #8
amateescu CreditAttribution: amateescu commentedjhodgdon, I also tested this with dsm($page) in a hook_page_alter implementation and chx's screenshot is right.
Comment #9
jhodgdonGood. :)
Comment #10
nlambert CreditAttribution: nlambert commentedthanks amateescu, that documentation will definitely speed things up!
Comment #11
webchickNice catch!
Committed to HEAD. Thanks!