You are here

function flag_entity_view in Flag 7.2

Same name and namespace in other branches
  1. 8.4 flag.module \flag_entity_view()
  2. 7.3 flag.module \flag_entity_view()

Implements hook_entity_view().

Handles the 'show_on_entity' flag option.

Note this is broken for taxonomy terms.

See also

http://drupal.org/node/1067120

File

./flag.module, line 625
The Flag module.

Code

function flag_entity_view($entity, $type, $view_mode, $langcode) {
  $links = flag_link($type, $entity, $view_mode == 'teaser');
  if (isset($links)) {
    $entity->content['links']['flag'] = array(
      '#theme' => 'links',
      '#links' => $links,
      '#attributes' => array(
        'class' => array(
          'links',
          'inline',
        ),
      ),
    );
  }
}