You are here

function easy_social_preprocess_node in Easy Social 6

Prepare node to display easy social

File

./easy_social.module, line 243
This is the file description for Easy Social module.

Code

function easy_social_preprocess_node(&$variables) {

  //Prepare a variable to send to prepare links
  $node_info = new stdClass();
  $node_info->nid = $variables['nid'];
  $node_info->type = $variables['type'];
  $node_info->title = $variables['title'];
  $urls_ignored = variable_get('easysocial_ignore_paths', '');
  $page_match = FALSE;
  $path = drupal_get_path_alias($_GET['q']);

  // Compare with the internal and path alias (if any).
  $page_match = drupal_match_path($path, $urls_ignored);
  if ($path != $_GET['q']) {
    $page_match = $page_match || drupal_match_path($_GET['q'], $urls_ignored);
  }
  if (!$page_match) {

    //Load the Easy Social stuff
    $prepare_easy_social = _easy_social_prepare_node_links($node_info);

    //Add to node object
    $variables['node']->easy_social = $prepare_easy_social['html'];

    //Teaser Display
    if ($variables['teaser'] && isset($prepare_easy_social['display']['teaser'])) {
      $variables['content'] .= $prepare_easy_social['html'];
    }

    //Full node display
    if ($variables['page'] && isset($prepare_easy_social['display']['fullnode'])) {
      if (isset($prepare_easy_social['position']['top'])) {
        $variables['content'] = $prepare_easy_social['html'] . $variables['content'];
      }
      if (isset($prepare_easy_social['position']['bottom'])) {
        $variables['content'] .= $prepare_easy_social['html'];
      }
    }
  }
}