function patterns_menu in Patterns 7
Same name and namespace in other branches
- 5 patterns.module \patterns_menu()
- 6.2 patterns.module \patterns_menu()
- 6 patterns.module \patterns_menu()
- 7.2 patterns.module \patterns_menu()
Implements hook_menu().
File
- ./
patterns.module, line 98
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, 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' => '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 / UNPUBLISH
$items['admin/patterns/publish'] = array(
'title' => 'Publish Pattern',
'page callback' => 'patterns_publish_pattern',
'access arguments' => array(
'administer patterns',
),
'type' => MENU_CALLBACK,
);
$items['admin/patterns/unpublish'] = array(
'title' => 'Unpublish Pattern',
'page callback' => '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,
);
// Disable for now
// $items['admin/patterns/server'] = array(
// 'title' => 'Patterns Server',
// 'page callback' => 'drupal_get_form',
// 'page arguments' => array('patterns_import_server'),
// 'access arguments' => array('administer patterns'),
// 'type' => MENU_LOCAL_TASK,
// 'weight' => -5
// );
// This items were already commented.
/////////////////////////////////////////////////////
// Not ready
// $items[] = array('path' => 'admin/patterns/disable',
// 'access' => user_access('administer patterns'),
// 'title' => t('Disable Pattern'),
// 'callback' => 'drupal_get_form',
// 'callback arguments' => array('patterns_disable_pattern'),
// 'type' => MENU_CALLBACK
// );
// $items[] = array('path' => 'admin/patterns/revert',
// 'access' => user_access('administer patterns'),
// 'title' => t('Revert Pattern'),
// 'callback' => 'patterns_revert',
// 'type' => MENU_CALLBACK
// );
return $items;
}