You are here

function jquery_social_stream_block_content in jQuery social stream 7

Same name and namespace in other branches
  1. 8.2 jquery_social_stream.module \jquery_social_stream_block_content()
  2. 8 jquery_social_stream.module \jquery_social_stream_block_content()
  3. 7.2 jquery_social_stream.module \jquery_social_stream_block_content()

Returns content of feed block.

3 calls to jquery_social_stream_block_content()
JquerySocialStreamBean::view in plugins/bean/jquery_social_stream.inc
Displays the bean.
jquery_social_stream_block_view in ./jquery_social_stream.module
Implements hook_block_view().
jquery_social_stream_render in plugins/content_types/jquery_social_stream.inc
Render callback for the custom content type

File

./jquery_social_stream.module, line 147
Code for the Campaign social media module.

Code

function jquery_social_stream_block_content($conf, $content = '') {
  global $base_path;
  $block = array();
  $content_id = $conf['id'];
  unset($conf['id']);
  $header = $conf['header'];
  unset($conf['header']);
  $footer = $conf['footer'];
  unset($conf['footer']);
  if (isset($conf['general']) && is_array($conf['general'])) {
    $conf += $conf['general'];
  }
  unset($conf['general']);

  // Twitter callback path.
  $conf['feeds']['twitter']['url'] = $base_path . 'js/jquery_social_stream/' . JQUERY_SOCIAL_STREAM_TWITTER_PATH;

  // Google+ API key.
  $conf['feeds']['google']['api_key'] = variable_get('jquery_social_stream_google_key', '');

  // Instagram API info.
  $conf['feeds']['instagram']['accessToken'] = variable_get('jquery_social_stream_instagram_access_token', '');
  $conf['feeds']['instagram']['redirectUrl'] = variable_get('jquery_social_stream_instagram_redirect_url', '');
  $conf['feeds']['instagram']['clientId'] = variable_get('jquery_social_stream_instagram_client_id', '');
  if (!empty($conf['wall'])) {
    $conf['theme'] = 'dark_1';
    $conf['rotate'] = array(
      'delay' => 0,
    );
  }
  if (!empty($conf['theme'])) {
    $styles = jquery_social_stream_styles();
    $style = $styles[$conf['theme']];
    $conf['iconPath'] = $GLOBALS['base_path'] . $style['iconPath'];
    $conf['imagePath'] = $GLOBALS['base_path'] . $style['imagePath'];
    $css = $style['css'];
    foreach ($style['classes'] as $key => $val) {
      $conf[$key] = $val;
    }
  }
  $block['subject'] = '';
  $block['content'] = array(
    '#theme' => 'jquery_social_stream',
    '#content_id' => $content_id,
    '#content' => $content,
    '#header' => $header,
    '#footer' => $footer,
    '#attached' => array(
      'js' => array(),
    ),
  );
  if (empty($conf['wall'])) {
    if (isset($css)) {
      $block['content']['#attached']['css'] = array(
        $css,
      );
    }
  }
  else {

    // Plugin wall js.
    $block['content']['#attached']['js'][] = array(
      'data' => libraries_get_path('jquery-social-stream') . '/js/jquery.social.stream.wall.js',
      'type' => 'file',
    );
    $block['content']['#attached']['css'] = array(
      libraries_get_path('jquery-social-stream') . '/css/dcsns_wall.css',
    );
  }

  // Plugin stream js.
  $block['content']['#attached']['js'][] = array(
    'data' => libraries_get_path('jquery-social-stream') . '/js/jquery.social.stream.min.js',
    'type' => 'file',
  );

  // Module's js.
  $block['content']['#attached']['js'][] = array(
    'data' => drupal_get_path('module', 'jquery_social_stream') . '/jquery_social_stream.js',
    'type' => 'file',
  );

  // Settings.
  $block['content']['#attached']['js'][] = array(
    'data' => array(
      'jQuerySocialStream' => array(
        $content_id => $conf,
      ),
    ),
    'type' => 'setting',
  );
  return $block;
}