_content_field_invoke

Versions
5 – 6
_content_field_invoke($op, &$node, $teaser = NULL, $page = NULL)

Invoke a field hook.

For each operation, both this function and _content_field_invoke_default() are called so that the default database handling can occur.

▾ 7 functions call _content_field_invoke()

content_delete in contributions/cck/content.module
Delete node type fields.
content_delete_revision in contributions/cck/content.module
delete node type fields for a revision.
content_insert in contributions/cck/content.module
Insert node type fields.
content_load in contributions/cck/content.module
Load data for a node type's fields.
content_submit in contributions/cck/content.module
Submit form callback for node type fields.
content_update in contributions/cck/content.module
Update node type fields.
content_validate in contributions/cck/content.module
Validate form callback to handle node type fields.

Code

contributions/cck/content.module, line 533

<?php
function _content_field_invoke($op, &$node, $teaser = NULL, $page = NULL) {
  $type_name = is_string($node) ? $node : (is_array($node) ? $node['type'] : $node->type);
  $type = content_types($type_name);
  $field_types = _content_field_types();

  $return = array();
  if (count($type['fields'])) {
    foreach ($type['fields'] as $field) {
      $node_field = isset($node->$field['field_name']) ? $node->$field['field_name'] : array();

      $module = $field_types[$field['type']]['module'];
      $function = $module .'_field';
      if (function_exists($function)) {
        $result = $function($op, $node, $field, $node_field, $teaser, $page);
        if (is_array($result)) {
          $return = array_merge($return, $result);
        }
        else if (isset($result)) {
          $return[] = $result;
        }
      }
      // test for values in $node_field in case modules added items on insert
      if (isset($node->$field['field_name']) || count($node_field)) {
        $node->$field['field_name'] = $node_field;
      }
    }
  }
  return $return;
}
?>

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters (without spaces) shown in the image.