function _field_invoke


Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/
cis7 _field_invoke($op, $entity_type, $entity, &$a = NULL, &$b = NULL, $options = array())
cle7 _field_invoke($op, $entity_type, $entity, &$a = NULL, &$b = NULL, $options = array())
elmsmedia7 _field_invoke($op, $entity_type, $entity, &$a = NULL, &$b = NULL, $options = array())
icor7 _field_invoke($op, $entity_type, $entity, &$a = NULL, &$b = NULL, $options = array())
meedjum_blog7 _field_invoke($op, $entity_type, $entity, &$a = NULL, &$b = NULL, $options = array())
mooc7 _field_invoke($op, $entity_type, $entity, &$a = NULL, &$b = NULL, $options = array())

Invoke a field hook.


$op: Possible operations include:

  • form
  • validate
  • presave
  • insert
  • update
  • delete
  • delete revision
  • view
  • prepare translation

$entity_type: The type of $entity; e.g. 'node' or 'user'.

$entity: The fully formed $entity_type entity.


  • The $form in the 'form' operation.
  • The value of $view_mode in the 'view' operation.
  • Otherwise NULL.


  • The $form_state in the 'submit' operation.
  • Otherwise NULL.

$options: An associative array of additional options, with the following keys:

  • 'field_name': The name of the field whose operation should be invoked. By default, the operation is invoked on all the fields in the entity's bundle. NOTE: This option is not compatible with the 'deleted' option; the 'field_id' option should be used instead.
  • 'field_id': The id of the field whose operation should be invoked. By default, the operation is invoked on all the fields in the entity's' bundles.
  • 'default': A boolean value, specifying which implementation of the operation should be invoked.

    • if FALSE (default), the field types implementation of the operation will be invoked (hook_field_[op])
    • If TRUE, the default field implementation of the field operation will be invoked (field_default_[op])

    Internal use only. Do not explicitely set to TRUE, but use _field_invoke_default() instead.

  • 'deleted': If TRUE, the function will operate on deleted fields as well as non-deleted fields. If unset or FALSE, only non-deleted fields are operated on.
  • 'language': A language code or an array of language codes keyed by field name. It will be used to narrow down to a single value the available languages to act on.

Related topics

9 calls to _field_invoke()
field_attach_delete in modules/field/
Delete field data for an existing entity. This deletes all revisions of field data for the entity.
field_attach_delete_revision in modules/field/
Delete field data for a single revision of an existing entity. The passed entity must have a revision id attribute.
field_attach_insert in modules/field/
Save field data for a new entity.
field_attach_prepare_translation in modules/field/
Prepares an entity for translation.
field_attach_presave in modules/field/
Perform necessary operations just before fields data get saved.

... See full list


modules/field/, line 181
Field attach API, allowing entities (nodes, users, ...) to be 'fieldable'.


function _field_invoke($op, $entity_type, $entity, &$a = NULL, &$b = NULL, $options = array()) {
  // Merge default options.
  $default_options = array(
    'default' => FALSE,
    'deleted' => FALSE,
    'language' => NULL,
  $options += $default_options;

  // Determine the list of instances to iterate on.
  list(, , $bundle) = entity_extract_ids($entity_type, $entity);
  $instances = _field_invoke_get_instances($entity_type, $bundle, $options);

  // Iterate through the instances and collect results.
  $return = array();
  foreach ($instances as $instance) {
    // field_info_field() is not available for deleted fields, so use
    // field_info_field_by_id().
    $field = field_info_field_by_id($instance['field_id']);
    $field_name = $field['field_name'];
    $function = $options['default'] ? 'field_default_' . $op : $field['module'] . '_field_' . $op;
    if (function_exists($function)) {
      // Determine the list of languages to iterate on.
      $available_languages = field_available_languages($entity_type, $field);
      $languages = _field_language_suggestion($available_languages, $options['language'], $field_name);

      foreach ($languages as $langcode) {
        $items = isset($entity->{$field_name}[$langcode]) ? $entity->{$field_name}[$langcode] : array();
        $result = $function($entity_type, $entity, $field, $instance, $langcode, $items, $a, $b);
        if (isset($result)) {
          // For hooks with array results, we merge results together.
          // For hooks with scalar results, we collect results in an array.
          if (is_array($result)) {
            $return = array_merge($return, $result);
          else {
            $return[] = $result;

        // Populate $items back in the field values, but avoid replacing missing
        // fields with an empty array (those are not equivalent on update).
        if ($items !== array() || isset($entity->{$field_name}[$langcode])) {
          $entity->{$field_name}[$langcode] = $items;

  return $return;



Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/ in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/
The website encountered an unexpected error. Please try again later.