You are here

function skinr_ui_menu in Skinr 7.2

Same name and namespace in other branches
  1. 6.2 skinr_ui.module \skinr_ui_menu()

Implements hook_menu().

File

./skinr_ui.module, line 60
Handles Skinr UI functionality allowing users to apply skins to their site.

Code

function skinr_ui_menu() {
  $items['admin/structure/skinr'] = array(
    'title' => 'Skinr',
    'description' => 'Manage your skin configurations and import/export skin configurations.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'skinr_ui_list',
    ),
    'access arguments' => array(
      'administer skinr',
    ),
    'file' => 'skinr_ui.admin.inc',
  );
  $items['admin/structure/skinr/list'] = array(
    'title' => 'List',
    'description' => t('Manage skinr configurations.'),
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10,
  );

  // Themes.
  $default_theme = variable_get('theme_default', 'bartik');
  $items['admin/structure/skinr/library'] = array(
    'title' => 'Library',
    'description' => 'Manage what skins are available when configuring the way your site looks.',
    'page callback' => 'skinr_ui_admin_library',
    'page arguments' => array(
      $default_theme,
    ),
    'access arguments' => array(
      'administer skinr',
    ),
    'file' => 'skinr_ui.admin.inc',
    'type' => MENU_LOCAL_TASK,
  );
  foreach (list_themes() as $key => $theme) {
    $items['admin/structure/skinr/library/list/' . $key] = array(
      'title' => check_plain($theme->info['name']),
      'page arguments' => array(
        $key,
      ),
      'type' => $key == $default_theme ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK,
      'weight' => $key == $default_theme ? -10 : 0,
      'access callback' => '_skinr_ui_themes_access',
      'access arguments' => array(
        $theme,
      ),
      'file' => 'skinr_ui.admin.inc',
    );
  }

  // Import & Export.
  $items['admin/structure/skinr/import'] = array(
    'title' => 'Import',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'skinr_ui_import_form',
    ),
    'type' => MENU_LOCAL_TASK,
    'access arguments' => array(
      'administer skinr',
    ),
    'weight' => 2,
    'description' => t('Import skin configurations.'),
    'file' => 'skinr_ui.admin.inc',
  );
  $items['admin/structure/skinr/export'] = array(
    'title' => 'Export',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'skinr_ui_export_form',
    ),
    'type' => MENU_LOCAL_TASK,
    'access arguments' => array(
      'administer skinr',
    ),
    'weight' => 3,
    'description' => t('Export skin configurations.'),
    'file' => 'skinr_ui.admin.inc',
  );

  // Add skin settings for an element.
  $items['admin/structure/skinr/add'] = array(
    'title' => 'Add skin',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'skinr_ui_add',
    ),
    'type' => MENU_LOCAL_ACTION,
    'access arguments' => array(
      'edit skin settings',
    ),
    'file' => 'skinr_ui.admin.inc',
  );

  // Configure skin settings for an element.
  $items['admin/structure/skinr/edit/%/%'] = array(
    'title' => 'Edit skin',
    'title callback' => 'skinr_ui_edit_title',
    'title arguments' => array(
      4,
      5,
    ),
    'page callback' => 'skinr_ui_edit',
    'page arguments' => array(
      4,
      5,
    ),
    // module, element
    'type' => MENU_CALLBACK,
    'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
    'access arguments' => array(
      'edit skin settings',
    ),
    'file' => 'skinr_ui.edit.inc',
  );
  $items['admin/structure/skinr/edit/%/%/configure'] = array(
    'title' => 'Edit skin',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'context' => MENU_CONTEXT_INLINE,
  );

  // Enable a skin configuration.
  $items['admin/structure/skinr/skin/%skinr_skin/enable'] = array(
    'title' => 'Enable skin',
    'page callback' => 'skinr_ui_skin_status_set',
    'page arguments' => array(
      4,
      TRUE,
    ),
    'type' => MENU_CALLBACK,
    'access arguments' => array(
      'administer skinr',
    ),
    'file' => 'skinr_ui.admin.inc',
  );

  // Disable a skin configuration.
  $items['admin/structure/skinr/skin/%skinr_skin/disable'] = array(
    'title' => 'Disable skin',
    'page callback' => 'skinr_ui_skin_status_set',
    'page arguments' => array(
      4,
      FALSE,
    ),
    'type' => MENU_CALLBACK,
    'access arguments' => array(
      'administer skinr',
    ),
    'file' => 'skinr_ui.admin.inc',
  );

  // Revert a skin configuration.
  $items['admin/structure/skinr/skin/%skinr_skin/revert'] = array(
    'title' => 'Revert skin',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'skinr_ui_revert_confirm',
      4,
    ),
    'type' => MENU_CALLBACK,
    'access arguments' => array(
      'administer skinr',
    ),
    'file' => 'skinr_ui.admin.inc',
  );

  // Delete a skin configuration.
  $items['admin/structure/skinr/skin/%skinr_skin/delete'] = array(
    'title' => 'Delete skin',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'skinr_ui_delete_confirm',
      4,
    ),
    'type' => MENU_CALLBACK,
    'access arguments' => array(
      'administer skinr',
    ),
    'file' => 'skinr_ui.admin.inc',
  );
  return $items;
}