You are here

function addtoany_node_view in AddToAny Share Buttons 7

Same name and namespace in other branches
  1. 5.0 addtoany.module \addtoany_node_view()
  2. 7.4 addtoany.module \addtoany_node_view()
  3. 7.3 addtoany.module \addtoany_node_view()

Implementation of hook_node_view().

File

./addtoany.module, line 32
Stand alone module file to handle AddToAny button integration

Code

function addtoany_node_view($node, $view_mode) {
  $links = array();
  $types = variable_get('addtoany_nodetypes', array());
  $teaser = $view_mode == 'teaser' ? TRUE : FALSE;
  $show = !empty($types[$node->type]) && ($teaser && variable_get('addtoany_display_in_teasers', '1') != 0 || !$teaser && variable_get('addtoany_display_in_nodelink', '1') != 0);
  if ($show) {
    $node->content['links']['#links']['addtoany'] = array(
      'title' => _addtoany_create_button($node, $teaser),
      'html' => TRUE,
    );
  }
  $show = !empty($types[$node->type]) && variable_get('addtoany_display_in_nodecont', '0');
  $weight = variable_get('addtoany_display_weight', 40);
  if ($show) {
    $node->content['addtoany'] = array(
      '#markup' => _addtoany_create_button($node, FALSE),
      '#weight' => $weight,
    );
  }
}