function content_menu in Content Construction Kit (CCK) 6.3
Same name and namespace in other branches
- 5 content.module \content_menu()
- 6 content.module \content_menu()
- 6.2 content.module \content_menu()
Implementation of hook_menu().
File
- ./
content.module, line 77 - Allows administrators to associate custom fields to content types.
Code
function content_menu() {
$items = array();
$items['admin/content/types/fields'] = array(
'title' => 'Fields',
'page callback' => 'content_fields_list',
'access arguments' => array(
'administer content types',
),
'file' => 'includes/content.admin.inc',
'type' => MENU_LOCAL_TASK,
);
// Callback for AHAH add more buttons.
$items['content/js_add_more'] = array(
'page callback' => 'content_add_more_js',
'access arguments' => array(
'access content',
),
'file' => 'includes/content.node_form.inc',
'type' => MENU_CALLBACK,
);
// Make sure this doesn't fire until content_types is working,
// and tables are updated, needed to avoid errors on initial installation.
if (!defined('MAINTENANCE_MODE') && variable_get('content_schema_version', -1) >= 6007) {
foreach (node_get_types() as $type) {
$type_name = $type->type;
$content_type = content_types($type_name);
$type_url_str = $content_type['url_str'];
$items['admin/content/node-type/' . $type_url_str . '/fields'] = array(
'title' => 'Manage fields',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'content_field_overview_form',
$type_name,
),
'access arguments' => array(
'administer content types',
),
'file' => 'includes/content.admin.inc',
'type' => MENU_LOCAL_TASK,
'weight' => 1,
);
$items['admin/content/node-type/' . $type_url_str . '/display'] = array(
'title' => 'Display fields',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'content_display_overview_form',
$type_name,
),
'access arguments' => array(
'administer content types',
),
'file' => 'includes/content.admin.inc',
'type' => MENU_LOCAL_TASK,
'weight' => 2,
);
$contexts = content_build_modes('_tabs');
foreach ($contexts as $key => $tab) {
$items['admin/content/node-type/' . $type_url_str . '/display/' . $key] = array(
'title' => $tab['title'],
'page arguments' => array(
'content_display_overview_form',
$type_name,
$key,
),
'access arguments' => array(
'administer content types',
),
'type' => $key == 'basic' ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK,
'weight' => $key == 'basic' ? 0 : 1,
);
}
// Cast as an array in case this is called before any fields have
// been added, like when a new content type is created.
foreach ((array) $content_type['fields'] as $field) {
$field_name = $field['field_name'];
$items['admin/content/node-type/' . $type_url_str . '/fields/' . $field_name] = array(
'title' => $field['widget']['label'],
'page callback' => 'drupal_get_form',
'page arguments' => array(
'content_field_edit_form',
$type_name,
$field_name,
),
'access arguments' => array(
'administer content types',
),
'file' => 'includes/content.admin.inc',
'type' => MENU_LOCAL_TASK,
);
$items['admin/content/node-type/' . $type_url_str . '/fields/' . $field_name . '/remove'] = array(
'title' => 'Remove field',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'content_field_remove_form',
$type_name,
$field_name,
),
'access arguments' => array(
'administer content types',
),
'file' => 'includes/content.admin.inc',
'type' => MENU_CALLBACK,
);
}
}
}
return $items;
}