You are here

function service_links_show in Service links 7.2

Same name and namespace in other branches
  1. 6.2 service_links.module \service_links_show()

Check if the service links should be displayed for the content type, for category or one of the other selected options.

12 calls to service_links_show()
service_links_block_view in ./service_links.module
Implements hook_block_view().
service_links_node_view in ./service_links.module
Implements hook_node_view().
themename_preprocess in ./template.php
If something doesn't work well try this.
themename_preprocess_node in ./template.php
Example 2: Creating the variable '$twitter' for the template file 'node.tpl.php' containing the services specified by their ids (i.e. twitter).
themename_preprocess_page in ./template.php
Example 1: Creating the variable '$service_links_rendered' for the template file 'page.tpl.php' containing all the selected services.

... See full list

3 string references to 'service_links_show'
service_links_admin_services in ./service_links.admin.inc
Menu callback administration settings for services links list.
service_links_update_6200 in ./service_links.install
Update from Service Links 1.x.
_service_links_load_settings in ./service_links.module
Load the static settings and keep clear the render function.

File

./service_links.module, line 861
Adds social network links to the content.

Code

function service_links_show($node) {
  $links_show = FALSE;
  $category_type = FALSE;
  global $user;
  if (!_service_links_match_path()) {
    return FALSE;
  }
  if (in_array(strtolower(arg(0)), array(
    'print',
    'printpdf',
    'printmail',
  ))) {
    return FALSE;
  }
  if (variable_get('service_links_hide_for_author', FALSE) && $user->uid == $node->uid) {
    return FALSE;
  }
  if (variable_get('service_links_hide_if_unpublished', FALSE) && $node->status == '0') {
    return FALSE;
  }
  $node_type = in_array($node->type, variable_get('service_links_node_types', array()), TRUE);
  if (module_exists('taxonomy') && !empty($node->field_tags)) {
    $categories_allowed = variable_get('service_links_category_types', array());
    $language = isset($node->field_tags[$node->language]) ? $node->language : 'und';
    foreach ($node->field_tags[$language] as $term) {
      $tid = FALSE;
      if (isset($term['tid'])) {
        $tid = $term['tid'];
      }
      else {
        if (isset($term['target_id'])) {
          $tid = $term['target_id'];
        }
      }
      if ($tid) {
        $category_type |= in_array($tid, $categories_allowed, FALSE);
      }
    }
  }
  if ($node_type || $category_type) {
    $links_show = TRUE;
  }
  return $links_show;
}