function hook_entity_view

cis7 system.api.php hook_entity_view($entity, $type, $view_mode, $langcode)
cle7 system.api.php hook_entity_view($entity, $type, $view_mode, $langcode)
elmsmedia7 system.api.php hook_entity_view($entity, $type, $view_mode, $langcode)
icor7 system.api.php hook_entity_view($entity, $type, $view_mode, $langcode)
meedjum_blog7 system.api.php hook_entity_view($entity, $type, $view_mode, $langcode)
mooc7 system.api.php hook_entity_view($entity, $type, $view_mode, $langcode)

Act on entities being assembled before rendering.

Parameters

$entity: The entity object.

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

$view_mode: The view mode the entity is rendered in.

$langcode: The language code used for rendering.

The module may add elements to $entity->content prior to rendering. The structure of $entity->content is a renderable array as expected by drupal_render().

See also

hook_entity_view_alter()

hook_comment_view()

hook_node_view()

hook_user_view()

Related topics

7 functions implement hook_entity_view()

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

cis_shortcodes_entity_view in sites/all/modules/elmsln_contrib/cis_connector/modules/cis_shortcodes/cis_shortcodes.module
Implements hook_entity_view().
entity_iframe_entity_view in sites/all/modules/elmsln_contrib/entity_iframe/entity_iframe.module
Implements hook_entity_view().
field_collection_table_entity_view in sites/all/modules/ulmus/field_collection_table/field_collection_table.module
Implements hook_entity_view().
icor_interactive_player_entity_view in profiles/icor/modules/features/icor_interactive_player/icor_interactive_player.module
Implements hook_entity_view().
taxonomy_test_entity_view in modules/simpletest/tests/taxonomy_test.module
Implements hook_entity_view().

... See full list

14 invocations of hook_entity_view()
accessibility_test_render in sites/all/modules/ulmus/accessibility/accessibility.module
comment_build_content in modules/comment/comment.module
Builds a structured array representing the comment's content.
ctools_entity_field_extra_content_type_render in sites/all/modules/ulmus/ctools/plugins/content_types/entity_context/entity_field_extra.inc
Render the extra field.
ctools_node_content_render_node in sites/all/modules/ulmus/ctools/plugins/content_types/node_context/node_content.inc
ctools_node_content_render_node in sites/all/modules/ulmus/ctools/plugins/content_types/node_context/node_content.inc

... See full list

File

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

Code

function hook_entity_view($entity, $type, $view_mode, $langcode) {
  $entity->content['my_additional_field'] = array(
    '#markup' => $additional_field,
    '#weight' => 10,
    '#theme' => 'mymodule_my_additional_field',
  );
}