You are here

function _content_field_invoke_default in Content Construction Kit (CCK) 5

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

Invoke content.module's version of a field hook.

7 calls to _content_field_invoke_default()
content_delete in ./content.module
Delete node type fields.
content_delete_revision in ./content.module
delete node type fields for a revision.
content_insert in ./content.module
Insert node type fields.
content_load in ./content.module
Load data for a node type's fields.
content_submit in ./content.module
Submit form callback for node type fields.

... See full list

File

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

Code

function _content_field_invoke_default($op, &$node, $teaser = NULL, $page = NULL) {
  $type_name = is_string($node) ? $node : (is_array($node) ? $node['type'] : $node->type);
  $type = content_types($type_name);
  $return = array();
  if (count($type['fields'])) {
    foreach ($type['fields'] as $field) {
      $node_field = isset($node->{$field}['field_name']) ? $node->{$field}['field_name'] : array();
      $db_info = content_database_info($field);
      if (count($db_info['columns'])) {
        $result = content_field($op, $node, $field, $node_field, $teaser, $page);
        if (is_array($result)) {
          $return = array_merge($return, $result);
        }
        else {
          if (isset($result)) {
            $return[] = $result;
          }
        }
      }
      if (isset($node->{$field}['field_name'])) {
        $node->{$field}['field_name'] = $node_field;
      }
    }
  }
  return $return;
}