function field_attach_preprocess


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_attach_preprocess($entity_type, $entity, $element, &$variables)
cle7 field_attach_preprocess($entity_type, $entity, $element, &$variables)
elmsmedia7 field_attach_preprocess($entity_type, $entity, $element, &$variables)
icor7 field_attach_preprocess($entity_type, $entity, $element, &$variables)
meedjum_blog7 field_attach_preprocess($entity_type, $entity, $element, &$variables)
mooc7 field_attach_preprocess($entity_type, $entity, $element, &$variables)

Populate the template variables with the field values available for rendering.

The $variables array will be populated with all the field instance values associated with the given entity type, keyed by field name; in case of translatable fields the language currently chosen for display will be selected.


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

$entity: The entity with fields to render.

$element: The structured array containing the values ready for rendering.

$variables: The variables array is passed by reference and will be populated with field values.

Related topics

6 calls to field_attach_preprocess()
template_preprocess_comment in modules/comment/comment.module
Process variables for comment.tpl.php.
template_preprocess_entity in sites/all/modules/ulmus/entity/theme/
Process variables for entity.tpl.php.
template_preprocess_file_entity in sites/all/modules/ulmus/file_entity/file_entity.module
Process variables for file_entity.tpl.php
template_preprocess_node in modules/node/node.module
Processes variables for node.tpl.php
template_preprocess_taxonomy_term in modules/taxonomy/taxonomy.module
Process variables for taxonomy-term.tpl.php.

... See full list


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


function field_attach_preprocess($entity_type, $entity, $element, &$variables) {
  list(, , $bundle) = entity_extract_ids($entity_type, $entity);

  foreach (field_info_instances($entity_type, $bundle) as $instance) {
    $field_name = $instance['field_name'];
    if (isset($element[$field_name]['#language'])) {
      $langcode = $element[$field_name]['#language'];
      $variables[$field_name] = isset($entity->{$field_name}[$langcode]) ? $entity->{$field_name}[$langcode] : NULL;

  // Let other modules make changes to the $variables array.
  $context = array(
    'entity_type' => $entity_type,
    'entity' => $entity,
    'element' => $element,
  drupal_alter('field_attach_preprocess', $variables, $context);