You are here

function social_media_links_block_view in Social Media Links Block and Field 7

Implements hook_block_view().

File

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

Code

function social_media_links_block_view($delta = '') {
  $block = array();
  switch ($delta) {
    case 'social-media-links':
      $platforms = variable_get('social_media_links_platforms', array());
      $platforms = _social_media_links_cleanup_platforms($platforms);
      if (count($platforms) > 0) {
        $block['subject'] = t('Follow Us');
        $block['content'] = array(
          '#theme' => 'social_media_links_platforms',
          '#platform_values' => $platforms,
          '#icon_style' => variable_get('social_media_links_icon_style'),
          '#appearance' => variable_get('social_media_links_appearance'),
          '#link_attributes' => variable_get('social_media_links_link_attributes'),
          '#attributes' => array(
            'class' => array(
              'social-media-links',
              'platforms',
            ),
          ),
        );

        // Add css to the block.
        $block['content']['#attached']['css'][] = drupal_get_path('module', 'social_media_links') . '/social_media_links.css';
      }
      break;
  }
  return $block;
}