flickrgallery.module in FlickrGallery 7.3
Same filename and directory in other branches
This module shows the sets and photo's from a Flickr account
File
flickrgallery.moduleView source
<?php
/**
* @file
* This module shows the sets and photo's from a Flickr account
*/
/**
* Implements hook_init().
*/
function flickrgallery_init() {
// Require FlickrAPI.
module_load_include('module', 'flickrapi');
// Add CSS file.
drupal_add_css(drupal_get_path('module', 'flickrgallery') . '/flickrgallery.css');
}
/**
* Implements hook_help().
*/
function flickrgallery_help($path, $arg) {
if ($path == 'admin/help#flickrgallery') {
return '<p>' . t('This module shows the sets and photo\'s from a Flickr account.') . '</p>';
}
}
/**
* Implements hook_permission().
*/
function flickrgallery_permission() {
return array(
'view photosets' => array(
'title' => t('View photosets'),
'description' => t('View the sets and images from the Flickr Gallery'),
),
'administer flickr settings' => array(
'title' => t('Administer Flickr settings'),
'description' => t('Administer the settings for the Flickr Gallery'),
),
);
}
/**
* Implements hook_menu().
*/
function flickrgallery_menu() {
$items = array();
$items['admin/config/media/flickgallery/gallery'] = array(
'title' => 'Flickr Gallery Settings',
'description' => 'Configure options for the flickr Gallery module',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'flickrgallery_settings_form',
),
'access arguments' => array(
'administer flickr settings',
),
'file' => 'includes/flickrgallery.admin.inc',
'file path' => drupal_get_path('module', 'flickrgallery'),
);
$items[variable_get('flickrgallery_path', 'flickr')] = array(
'title' => variable_get('flickrgallery_title', 'Flickr Gallery'),
'page callback' => 'flickrgallery_wrapper_albums',
'access arguments' => array(
'view photosets',
),
'type' => MENU_NORMAL_ITEM,
'weight' => -100,
'file' => 'includes/flickrgallery.pages.inc',
'file path' => drupal_get_path('module', 'flickrgallery'),
);
$set_path = variable_get('flickrgallery_path', 'flickr') . '/set/%';
$cnt_set_path = count(explode("/", $set_path)) - 1;
$items[$set_path] = array(
'title callback' => 'flickrgallery_menu_title_callback',
'title arguments' => array(
$cnt_set_path,
),
'page callback' => 'flickrgallery_set',
'access arguments' => array(
'view photosets',
),
'page arguments' => array(
$cnt_set_path,
),
'type' => MENU_CALLBACK,
'file' => 'includes/flickrgallery.pages.inc',
'file path' => drupal_get_path('module', 'flickrgallery'),
);
return $items;
}
/**
* Album page title callback
*/
function flickrgallery_menu_title_callback($set_id) {
// Create Flickr object.
$f = flickrapi_phpFlickr();
// Get Flickr set info.
$set_info = $f
->photosets_getInfo($set_id);
// Set Flickr set title as page title.
return $set_info['title']['_content'];
}
/**
* Implements hook_block_info().
*/
function flickrgallery_block_info() {
$blocks['flickrgallery_block'] = array(
'info' => t('FlickrGallery block'),
);
return $blocks;
}
/**
* Implements hook_block_view().
*/
function flickrgallery_block_view($delta) {
$block = array();
switch ($delta) {
case 'flickrgallery_block':
module_load_include('inc', 'flickrgallery', 'includes/flickrgallery.pages');
$block['subject'] = variable_get('flickrgallery_title', 'Flickr Gallery');
$block['content'] = flickrgallery_wrapper_albums();
break;
}
return $block;
}
/**
* Implements hook_theme().
*/
function flickrgallery_theme($existing, $type, $theme, $path) {
$path = drupal_get_path('module', 'flickrgallery');
return array(
'flickrgallery_albums' => array(
'variables' => array(
'description' => NULL,
'albums' => NULL,
),
'template' => 'flickrgallery_albums',
'path' => $path . '/theme',
),
'flickrgallery_photoset' => array(
'variables' => array(
'photoset' => NULL,
'meta' => NULL,
),
'template' => 'flickrgallery_photoset',
'path' => $path . '/theme',
),
'flickrgallery_photo' => array(
'variables' => array(
'image' => NULL,
'image_meta' => NULL,
),
'template' => 'flickrgallery_photo',
'path' => $path . '/theme',
),
);
}
Functions
Name![]() |
Description |
---|---|
flickrgallery_block_info | Implements hook_block_info(). |
flickrgallery_block_view | Implements hook_block_view(). |
flickrgallery_help | Implements hook_help(). |
flickrgallery_init | Implements hook_init(). |
flickrgallery_menu | Implements hook_menu(). |
flickrgallery_menu_title_callback | Album page title callback |
flickrgallery_permission | Implements hook_permission(). |
flickrgallery_theme | Implements hook_theme(). |