Hi,
I have written the simplest possible module for a content type which has only one single field - the 'Title' which I renamed to 'Full Name' (I have removed the body as I dont need it).
All good - I can add content and view it just fine: For each added node it displays what I have specified in the 'Full Name' field.
Then I tried to extend this by using the hook_view() to display some additional data (first and last name) when viewing each node but so far I had no joy. In the example below I try to display simple string as additional data, but even that doesnt work:
/**
* Implementation of hook_view().
*/
function person_view($node, $view_mode = 'full') {
// Use Drupal's default node view.
$node = node_load($node->nid);
// Add first and last names.
$node->content['name_first'] = array(
'#value' => theme('person_name_first', $node),
'#weight' => 2
);
$node->content['name_last'] = array(
'#value' => theme('person_name_last', $node),
'#weight' => 3
);
return $node;
}
/**
* Implementation of hook_theme().
*/
function person_theme() {
return array(
'person_name_first' => array(
'arguments' => array('node'),
),
'person_name_last' => array(
'arguments' => array('node'),
),
);
}
function theme_person_name_first($node) {