You are here

function dynamic_background_menu in Dynamic Background 7.2

Same name and namespace in other branches
  1. 6 dynamic_background.module \dynamic_background_menu()
  2. 7 dynamic_background.module \dynamic_background_menu()

Implements hook_menu().

File

./dynamic_background.module, line 48
This module enables administrators to upload images used as background on the site. The selected background image link is exposed as either $background in the page.tpl file or as /background.css.

Code

function dynamic_background_menu() {
  $items = array();
  $items['admin/config/user-interface/backgrounds'] = array(
    'title' => 'Dynamic background',
    'description' => 'Upload background images.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'dynamic_background_admin_images',
    ),
    'access arguments' => array(
      'dynamic backgrounds set default',
    ),
    'file' => 'includes/backgrounds.admin.inc',
  );
  $items['admin/config/user-interface/backgrounds/images'] = array(
    'title' => 'Background images',
    'description' => 'Upload background images and select current active background.',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10,
  );
  $items['admin/config/user-interface/backgrounds/weight'] = array(
    'title' => 'Weight',
    'description' => 'Configure dynamic backgrounds extension weight',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'dynamic_background_admin_weight_form',
    ),
    'access arguments' => array(
      'dynamic backgrounds weight',
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => 10,
    'file' => 'includes/weight.admin.inc',
  );
  $items['background.css'] = array(
    'page callback' => 'dynamic_background_css',
    'access arguments' => array(
      'dynamic backgrounds css callback',
    ),
    'type' => MENU_CALLBACK,
  );

  // Build menu for extensions (using hook_dynamic_background_info).
  foreach (module_implements('dynamic_background_info') as $module) {
    $function = $module . '_dynamic_background_info';
    $result = $function();
    if ($result && is_array($result)) {
      $items['admin/config/user-interface/backgrounds/' . $result['type']] = array(
        'title' => $result['menu']['title'],
        'description' => $result['menu']['description'],
        'page callback' => 'drupal_get_form',
        'page arguments' => array(
          'dynamic_background_build_settings_form',
          $module,
          $result['upload'],
        ),
        'access arguments' => array(
          'dynamic background configure ' . $result['type'],
        ),
        'weight' => isset($result['menu']['weight']) ? $result['menu']['weight'] : 0,
        'type' => MENU_LOCAL_TASK,
      );
    }
  }
  return $items;
}