You are here

function hook_profile2_view in Profile 2 7.2

Same name and namespace in other branches
  1. 7 profile2.api.php \hook_profile2_view()

Act on a profile that is being assembled before rendering.

Parameters

$profile: The profile entity.

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

$langcode: The language code used for rendering.

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

See also

hook_entity_prepare_view()

hook_entity_view()

File

./profile2.api.php, line 116
This file contains no working PHP code; it exists to provide additional documentation for doxygen as well as to document hooks in the standard Drupal manner.

Code

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