'. t('Uses the Vegas jQuery Plugin to provide beautiful background images and slideshows.', array('@vegas' => 'http://github.com/jaysalvat/vegas')) .'

'; case 'admin/appearance/vegas': return '

'. t('Set up beautiful background images and slideshows by uploading images, and configuring the fade and delay effects with the Vegas jQuery Plugin.', array('@vegas' => 'http://github.com/jaysalvat/vegas')) .'

'; } } /** * Implements hook_permission(). */ function vegas_permission() { return array( 'administer vegas' => array( 'title' => t('Administer Vegas'), 'description' => t('Configure the background slideshows.'), ), ); } /** * Implements hook_menu(). */ function vegas_menu() { $items = array(); $items['admin/appearance/vegas'] = array( 'title' => 'Vegas', 'description' => 'Configure the fullscreen background slideshows for use with Vegas.', 'access arguments' => array('administer vegas'), 'page callback' => 'drupal_get_form', 'page arguments' => array('vegas_admin_settings'), 'file' => 'vegas.admin.inc', 'type' => MENU_LOCAL_TASK, 'weight' => 1000, ); return $items; } /** * Implements hook_init(). */ function vegas_init() { // Load all the images to be added to Vegas. $backgrounds = array(); $fade = variable_get('vegas_fade', 0); for ($i = 0; $i < 10; $i++) { $fid = variable_get('vegas_images_' . $i, ''); if (!empty($fid)) { $image = file_load($fid); if ($image) { $background = array( 'src' => file_create_url($image->uri), ); if (!empty($fade)) { $background['fade'] = intval($fade); } $backgrounds[] = $background; } } } // If there are images to show, then load the Vegas JavaScript as well. if (!empty($backgrounds)) { // See if we are to shuffle the backgrounds. if (variable_get('vegas_shuffle', TRUE)) { shuffle($backgrounds); } // Add all the Vegas JavaScript to the page. drupal_load('module', 'libraries'); libraries_load('vegas'); // Prepare the JavaScript settings. $settings = array( 'backgrounds' => $backgrounds, ); // Load up the delay amount. $delay = variable_get('vegas_delay', '5000'); $settings['delay'] = intval($delay); // Load the overlay, if possible. $fid = variable_get('vegas_overlay', ''); if (!empty($fid)) { $image = file_load($fid); if ($image) { $settings['overlay'] = file_create_url($image->uri); } } // Add it all to the page. drupal_add_js(array('vegas' => $settings), 'setting'); } } /** * Implements hook_libraries_info(). */ function vegas_libraries_info() { $libraries['vegas'] = array( 'name' => 'Vegas jQuery Plugin', 'vendor url' => 'https://github.com/jaysalvat/vegas', 'download url' => 'https://github.com/jaysalvat/vegas/archive/master.zip', 'version arguments' => array( 'file' => 'jquery.vegas.js', 'pattern' => '/v ((?:\d+\.?){2,3})$/', 'lines' => 10, 'cols' => 30, ), 'files' => array( 'js' => array( 'jquery.vegas.js', ), 'css' => array( 'jquery.vegas.css', ), ), 'integration files' => array( 'vegas' => array( 'js' => array('vegas.js'), ), ), ); return $libraries; }