You are here

facebook_album.module in Facebook Album 7

facebook_album.module

Creates the block for display and menu items for configuration

File

facebook_album.module
View source
<?php

/**
 * @file facebook_album.module
 *
 * Creates the block for display and menu items for configuration
 */

/**
 * Implements hook_menu()
 */
function facebook_album_menu() {
  $items = array();
  $items['admin/config/services/facebook_album'] = array(
    'title' => 'Facebook Album Settings',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'facebook_album_admin_form',
    ),
    'access arguments' => array(
      'facebook album',
    ),
    'file' => 'facebook_album.admin.inc',
    'type' => MENU_NORMAL_ITEM,
  );
  return $items;
}

/**
 * Implements hook_permission()
 */
function facebook_album_permission() {
  return array(
    'facebook album' => array(
      'title' => t('Administer Facebook Album'),
      'description' => t('Change settings for the Facebook Album Module'),
    ),
  );
}

/**
 * Implements hook_block_info().
 */
function facebook_album_block_info() {
  $blocks = array();
  $blocks['facebook_album'] = array(
    'info' => t('Facebook Album Gallery'),
  );
  return $blocks;
}

/**
 * Implements hook_block_view().
 */
function facebook_album_block_view($delta = '') {
  $block = array();
  switch ($delta) {
    case 'facebook_album':
      $block['content'] = array(
        '#markup' => '<div id="facebook-album"></div>',
        '#attached' => array(
          'css' => array(
            drupal_get_path('module', 'facebook_album') . '/css/facebook_album.css',
          ),
          'js' => array(
            array(
              'data' => '//connect.facebook.net/en_US/all.js',
              'type' => 'external',
            ),
            drupal_get_path('module', 'facebook_album') . '/js/facebook_album.js',
            array(
              'data' => array(
                'facebookAlbum' => facebook_album_get_settings(),
              ),
              'type' => 'setting',
            ),
          ),
        ),
      );
      break;
  }
  return $block;
}

/**
 * Takes all customized settings and returns them as an array
 */
function facebook_album_get_settings() {
  return array(
    'pageID' => variable_get('facebook_album_pageID', 'acromediainc'),
    'visibility' => variable_get('facebook_album_visibility', 0),
    'albums' => variable_get('facebook_album_albums', array()),
    'albumLimit' => variable_get('facebook_album_albumLimit', 3),
    'showDescription' => variable_get('facebook_album_showDescription', 1),
    'showLocation' => variable_get('facebook_album_showLocation', 1),
    'albumThumbWidth' => variable_get('facebook_album_albumThumbWidth', 365),
    'albumThumbHeight' => variable_get('facebook_album_albumThumbHeight', 250),
    'photoThumbWidth' => variable_get('facebook_album_photoThumbWidth', 160),
    'photoThumbHeight' => variable_get('facebook_album_photoThumbHeight', 120),
    'colorboxOptions' => variable_get('facebook_album_colorboxOptions', ''),
  );
}

Functions

Namesort descending Description
facebook_album_block_info Implements hook_block_info().
facebook_album_block_view Implements hook_block_view().
facebook_album_get_settings Takes all customized settings and returns them as an array
facebook_album_menu Implements hook_menu()
facebook_album_permission Implements hook_permission()