You are here

function content_view in Content Construction Kit (CCK) 6

Same name and namespace in other branches
  1. 5 content.module \content_view()
  2. 6.3 content.module \content_view()
  3. 6.2 content.module \content_view()

Nodeapi 'view' op.

Generate field render arrays.

2 calls to content_view()
content_nodeapi in ./content.module
Implementation of hook_nodeapi().
content_token_values in includes/content.token.inc

File

./content.module, line 342
Allows administrators to associate custom fields to content types.

Code

function content_view(&$node, $teaser = FALSE, $page = FALSE) {

  // Let field modules sanitize their data for output.
  _content_field_invoke('sanitize', $node, $teaser, $page);

  // Merge fields.
  $additions = _content_field_invoke_default('view', $node, $teaser, $page);
  $node->content = array_merge((array) $node->content, $additions);

  // Adjust weights for non-CCK fields.
  $type = content_types($node->type);
  foreach ($type['extra'] as $key => $value) {

    // Some core 'fields' use a different key in node forms and in 'view'
    // render arrays.
    if (isset($value['view']) && isset($node->content[$value['view']])) {
      $node->content[$value['view']]['#weight'] = $value['weight'];
    }
    elseif (isset($node->content[$key])) {
      $node->content[$key]['#weight'] = $value['weight'];
    }
  }
}