[development] Context in Drupal 6
Karoly Negyesi
karoly at negyesi.net
Thu Dec 20 20:22:43 UTC 2007
Following up this, phptemplate_preprocess_page was loading the node with
if ((arg(0) == 'node') && is_numeric(arg(1))) {
$variables['node'] = node_load(arg(1));
}
but on node/revisions/48/view this is wrong. We now have:
if ($node = menu_get_object()) {
$variables['node'] = $node;
}
Here is another example for this function:
if ((arg(0) == 'user') && is_numeric(arg(1))) {
$account = user_load(arg(1));
}
Gets replaced with $account = menu_get_object('user');
I know I should not change API this late but this function was a necessaery bugfix and hardwiring it for nodes looked a bad decision. See the documentation of this function on this new and IMO very useful -- but admittely limited -- context getter.
Regards,
NK
More information about the development
mailing list