Skip to content

Instantly share code, notes, and snippets.

@robballou
Created May 3, 2012 20:36
Show Gist options
  • Save robballou/2589066 to your computer and use it in GitHub Desktop.
Save robballou/2589066 to your computer and use it in GitHub Desktop.
custom_content_pages example page callback #1
<?php
function custom_content_pages_about() {
// load our content: since our path starts with the alias for this
// node, we can lookup the node source that way
$node_path = drupal_lookup_path('source', arg(0) .'/'. arg(1));
// now we can the actual node
$node = menu_get_object('node', 1, $node_path);
// set the title
drupal_set_title('About');
// update the breadcrumb
$breadcrumb = drupal_get_breadcrumb();
array_push($breadcrumb, '<a href="/'. arg(0) .'">Content</a>');
array_push($breadcrumb, '<a href="/'. arg(0) .'/'. arg(1) .'">'. $node->title .'</a>');
drupal_set_breadcrumb($breadcrumb);
// return the content for the page
return array(
'content' => array(
'#markup' => $node->field_about[$node->language][0]['safe_value'],
),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment