You are here

function theme_juicerio_feed in Juicer - Social Media Feed Aggregator 7

2 theme calls to theme_juicerio_feed()
juicerio_block_view in ./juicerio.module
Implements hook_block_view().
juicerio_settings_form in ./juicerio.admin.inc
Admin settings form.

File

./juicerio.module, line 53
Module file for the Juicer Integration module.

Code

function theme_juicerio_feed($variables) {
  if ($variables['feed_id'] != NULL) {

    // Add in the Juicer IO Javascript and CSS files
    $js_embed = variable_get('juicerio_js_embed', '//assets.juicer.io/embed-no-jquery.js');
    drupal_add_js($js_embed, array(
      'type' => 'external',
    ));
    drupal_add_css('//assets.juicer.io/embed.css', 'external');

    // Prepare all the attributes.
    $attributes = 'data-feed-id="' . $variables['feed_id'] . '"';
    if ($variables['post_num'] != NULL) {
      $attributes .= ' data-per="' . $variables['post_num'] . '"';
    }
    if ($variables['infinite_pages'] != NULL) {
      $attributes .= ' data-pages="' . $variables['infinite_pages'] . '"';
    }
    if ($variables['gutter_amt'] != NULL) {
      $attributes .= ' data-gutter="' . $variables['gutter_amt'] . '"';
    }
    if ($variables['column_num'] != NULL) {
      $attributes .= ' data-columns="' . $variables['column_num'] . '"';
    }
    if ($variables['filters'] != NULL) {
      $attributes .= ' data-filter="' . $variables['filters'] . '"';
    }

    // Assemble the output.
    $output = '<ul class="juicer-feed" ' . $attributes . '></ul>';
  }
  else {
    $output = t('Please !configure to see a social media feed.', array(
      '!configure' => l(t('provide a Juicer account name'), 'admin/config/services/juicerio'),
    ));
  }
  return $output;
}