You are here

function facebook_album_block_view in Facebook Album 7.3

Same name and namespace in other branches
  1. 7 facebook_album.module \facebook_album_block_view()
  2. 7.2 facebook_album.module \facebook_album_block_view()

Implements hook_block_view().

File

./facebook_album.module, line 244

Code

function facebook_album_block_view($delta = '') {
  $block = [];
  $app_token = variable_get('facebook_album_access_token');
  if (!isset($app_token)) {
    return $block;
  }
  if (strpos($delta, 'facebook_album_') !== FALSE) {
    $settings = facebook_album_get_settings($delta);
    $block['content'] = [
      '#markup' => '<div id="fba-delta-' . $delta . '" class="fba-container"><div class="fb-album-header"></div>' . '<div class="facebook-album-images-container"></div>' . '<div class="fb-loading-icon"></div></div>',
      '#attached' => [
        'css' => [
          drupal_get_path('module', 'facebook_album') . '/css/facebook_album.css',
          '#fba-delta-' . $delta . ' .album-thumb-wrapper i {width:' . $settings['albumThumbWidth'] . 'px;height:' . $settings['albumThumbHeight'] . 'px;}' => [
            'type' => 'inline',
          ],
          '#fba-delta-' . $delta . ' .photo-thumb-wrapper i {width:' . $settings['photoThumbWidth'] . 'px;height:' . $settings['photoThumbHeight'] . 'px;}' => [
            'type' => 'inline',
          ],
        ],
        'js' => [
          drupal_get_path('module', 'facebook_album') . '/js/facebook_album.js',
          [
            'data' => [
              'facebookAlbum' => [
                $delta => [
                  'colorboxOptions' => $settings['colorbox'],
                ],
              ],
            ],
            'type' => 'setting',
          ],
        ],
      ],
    ];
  }
  return $block;
}