You are here

function theme_social_media_links_platforms in Social Media Links Block and Field 7

Theme function for the platforms.

2 theme calls to theme_social_media_links_platforms()
social_media_links_block_view in ./social_media_links.module
Implements hook_block_view().
social_media_links_widget_render in plugins/content_types/social_media_link_widget.inc

File

./social_media_links.module, line 591
Functions for the Social Media Links module.

Code

function theme_social_media_links_platforms(&$variables) {
  $output = '';
  $platforms = $variables['platforms'];
  $attributes = $variables['attributes'];

  // Open the ul element.
  $output .= '<ul' . drupal_attributes($attributes) . '>';
  $num_platforms = count($platforms);
  $i = 1;
  foreach ($platforms as $name => $platform) {
    $class = array(
      $name,
    );

    // Add first and last classes to the list of platforms to help out themers.
    if ($i == 1) {
      $class[] = 'first';
    }
    if ($i == $num_platforms) {
      $class[] = 'last';
    }
    $output .= '<li ' . drupal_attributes(array(
      'class' => $class,
    )) . '>';

    // Render the platform item.
    $output .= drupal_render($platform);
    $output .= '</li>';
    $i++;
  }

  // Close the ul element.
  $output .= '</ul>';
  return $output;
}