You are here

function _follow_links_element in Follow 7.2

Helper function to build a follow links element.

Parameters

array $links: An array of follow links.

array $networks: An array of networks.

string $type: The type of follow links, user or site.

string $alignment: The alignment, horizontal or vertical.

2 calls to _follow_links_element()
theme_follow_links in ./follow.module
Theme function to output a list of links.
_follow_block_content in ./follow.module
Helper function to build the block content display.

File

./follow.inc, line 117
Follow module API and helper functions.

Code

function _follow_links_element(array $links, array $networks, $type, $alignment = NULL) {

  // Let's be sure the CSS exists before printing this.
  follow_save_css();
  $element['follow-links']['#prefix'] = "<div class='follow-links clearfix {$type}'>";
  $element['follow-links']['#attached']['css'][] = _follow_css_get_path();
  if (!isset($alignment)) {
    $alignment = variable_get("follow_{$type}_alignment", 'vertical');
  }
  $wrapper = $alignment == 'horizontal' ? 'span' : 'div';
  foreach ($links as $link) {
    $title = !empty($link->title) ? $link->title : $networks[$link->name]['title'];
    $element['follow-links'][$link->name] = array(
      '#prefix' => "<{$wrapper} class='follow-link-wrapper follow-link-wrapper-{$link->name}'>",
      '#theme' => 'follow_link',
      '#link' => $link,
      '#title' => $title,
      '#suffix' => "</{$wrapper}>",
    );
  }
  $element['follow-links']['#suffix'] = '</div>';
  return $element;
}