function hook_entity_view_alter

×

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/api.elmsln.org/includes/bootstrap.inc).
cis7 system.api.php hook_entity_view_alter(&$build, $type)
cle7 system.api.php hook_entity_view_alter(&$build, $type)
elmsmedia7 system.api.php hook_entity_view_alter(&$build, $type)
icor7 system.api.php hook_entity_view_alter(&$build, $type)
meedjum_blog7 system.api.php hook_entity_view_alter(&$build, $type)
mooc7 system.api.php hook_entity_view_alter(&$build, $type)

Alter the results of ENTITY_view().

This hook is called after the content has been assembled in a structured array and may be used for doing processing which requires that the complete entity content structure has been built.

If a module wishes to act on the rendered HTML of the entity rather than the structured content array, it may use this hook to add a #post_render callback. Alternatively, it could also implement hook_preprocess_ENTITY(). See drupal_render() and theme() for details.

Parameters

$build: A renderable array representing the entity content.

$type: The type of entity being rendered (i.e. node, user, comment).

See also

hook_entity_view()

hook_comment_view_alter()

hook_node_view_alter()

hook_taxonomy_term_view_alter()

hook_user_view_alter()

Related topics

3 functions implement hook_entity_view_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

display_cache_entity_view_alter in sites/all/modules/ulmus/display_cache/display_cache.module
Implements hook_entity_view_alter().
ds_extras_entity_view_alter in sites/all/modules/ulmus/ds/modules/ds_extras/ds_extras.module
Implements hook_entity_view_alter().
eva_entity_view_alter in sites/all/modules/ulmus/eva/eva.module
Implements hook_entity_view_alter().

File

modules/system/system.api.php, line 459
Hooks provided by Drupal core and the System module.

Code

function hook_entity_view_alter(&$build, $type) {
  if ($build['#view_mode'] == 'full' && isset($build['an_additional_field'])) {
    // Change its weight.
    $build['an_additional_field']['#weight'] = -10;

    // Add a #post_render callback to act on the rendered HTML of the entity.
    $build['#post_render'][] = 'my_module_node_post_render';
  }
}