function patterns_menu in Patterns 7.2
Same name and namespace in other branches
- 5 patterns.module \patterns_menu()
- 6.2 patterns.module \patterns_menu()
- 6 patterns.module \patterns_menu()
- 7 patterns.module \patterns_menu()
Implements hook_menu().
File
- ./
patterns.module, line 75
Code
function patterns_menu() {
$items = array();
$first_install = variable_get(PATTERNS_FIRST_INSTALL, TRUE);
if ($first_install) {
module_load_include('inc', 'patterns', 'includes/forms/first_install');
$items['admin/patterns'] = array(
'title' => 'Patterns',
'description' => 'Patterns was just installed or important updates have been found',
'page callback' => 'patterns_first_install_page',
'access arguments' => array(
'administer patterns',
),
);
return $items;
}
$items['admin/patterns'] = array(
'title' => 'Patterns',
'description' => 'Administer patterns available for your site',
'page callback' => 'patterns_list',
'access arguments' => array(
'administer patterns',
),
);
$items['admin/patterns/list'] = array(
'title' => 'List',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
if (patterns_utils_is_public_page_enabled()) {
$items[variable_get('patterns_public_url', '')] = array(
'title' => 'Public',
'type' => MENU_LOCAL_TASK,
'description' => 'Patterns',
'page callback' => 'patterns_list_public',
'access arguments' => array(
'public patterns',
),
'weight' => -9,
);
}
// Main routes
$items['admin/patterns/enable'] = array(
'title' => 'Enable Pattern',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'patterns_enable_pattern',
),
'access arguments' => array(
'administer patterns',
),
'type' => MENU_CALLBACK,
);
$items['admin/patterns/edit/%'] = array(
'title' => 'Edit Pattern',
'page callback' => 'patterns_edit_page',
'page arguments' => array(
3,
),
'access arguments' => array(
'administer patterns',
),
'type' => MENU_CALLBACK,
);
$items['admin/patterns/quickrun'] = array(
'title' => 'Quick Run',
'page callback' => 'patterns_editor',
'page arguments' => array(
'patterns_quickrun',
),
'access arguments' => array(
'administer patterns',
),
'type' => MENU_CALLBACK,
);
$items['admin/patterns/lab'] = array(
'title' => 'Lab',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'patterns_lab',
),
'access arguments' => array(
'administer patterns',
),
'type' => MENU_LOCAL_TASK,
);
$items['admin/patterns/create/%'] = array(
'title' => 'Create a new Pattern',
'page callback' => 'patterns_editor_create_page',
'page arguments' => array(
3,
),
'access arguments' => array(
'administer patterns',
),
'type' => MENU_CALLBACK,
);
// Settings
$items['admin/patterns/settings'] = array(
'title' => 'Settings',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'patterns_config_settings',
),
'access arguments' => array(
'administer patterns',
),
'type' => MENU_LOCAL_TASK,
'weight' => 10,
);
// Trash, restore and remove
$items['admin/patterns/trash'] = array(
'title' => 'Move Pattern to Recycle Bin',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'patterns_trash_pattern',
),
'access arguments' => array(
'administer patterns',
),
'type' => MENU_CALLBACK,
);
$items['admin/patterns/restore'] = array(
'title' => 'Restore a pattern from the recycle bin',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'patterns_restore_pattern',
),
'access arguments' => array(
'administer patterns',
),
'type' => MENU_CALLBACK,
);
$items['admin/patterns/remove'] = array(
'title' => 'Remove Pattern',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'patterns_remove_pattern',
),
'access arguments' => array(
'administer patterns',
),
'type' => MENU_CALLBACK,
);
// Utils
$items['admin/patterns/refresh'] = array(
'title' => 'Refresh Patterns',
'page callback' => 'patterns_io_get_patterns_service',
'access arguments' => array(
'administer patterns',
),
'type' => MENU_CALLBACK,
);
$items['admin/patterns/validate'] = array(
'title' => 'Validate Pattern YAML Source',
'page callback' => 'patterns_validate_service',
'access arguments' => array(
'administer patterns',
),
'type' => MENU_CALLBACK,
);
// Services
$items['patterns/patterns.xml'] = array(
'title' => 'Published Patterns',
'page callback' => 'patterns_feed',
'access arguments' => array(
'get patterns',
),
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
$items['patterns/get'] = array(
'title' => 'Download Pattern Source',
'page callback' => 'patterns_io_get_pattern_service',
'access arguments' => array(
'get patterns',
),
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
// Import
$items['admin/patterns/import'] = array(
'title' => 'Import',
'page callback' => 'patterns_editor',
'page arguments' => array(
'patterns_import_source',
),
'access arguments' => array(
'administer patterns',
),
'type' => MENU_LOCAL_TASK,
);
$items['admin/patterns/import/source'] = array(
'title' => 'Import Source Code',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
$items['admin/patterns/import/file'] = array(
'title' => 'Import File',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'patterns_import_file',
),
'access arguments' => array(
'administer patterns',
),
'type' => MENU_LOCAL_TASK,
);
$items['admin/patterns/import/url'] = array(
'title' => 'Import from URL',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'patterns_import_url',
),
'access arguments' => array(
'administer patterns',
),
'type' => MENU_LOCAL_TASK,
);
// Publish and unpublish
$items['admin/patterns/publish'] = array(
'title' => 'Publish Pattern',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'patterns_publish_pattern',
),
'access arguments' => array(
'administer patterns',
),
'type' => MENU_CALLBACK,
);
$items['admin/patterns/unpublish'] = array(
'title' => 'Unpublish Pattern',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'patterns_unpublish_pattern',
),
'access arguments' => array(
'administer patterns',
),
'type' => MENU_CALLBACK,
);
// Utility
$items['admin/patterns/info'] = array(
'title' => 'Info',
'page callback' => 'patterns_info_page',
'access arguments' => array(
'administer patterns',
),
'weight' => 15,
'type' => MENU_LOCAL_TASK,
);
$items['admin/patterns/check'] = array(
'title' => 'Pattern Modules',
'page callback' => 'patterns_modules_page',
'access arguments' => array(
'administer patterns',
),
'type' => MENU_CALLBACK,
);
return $items;
}