function content_menu in Content Construction Kit (CCK) 5
Same name and namespace in other branches
- 6.3 content.module \content_menu()
- 6 content.module \content_menu()
- 6.2 content.module \content_menu()
Implementation of hook_menu().
File
- ./
content.module, line 76 - Allows administrators to associate custom fields to content types.
Code
function content_menu($may_cache) {
if (!$may_cache) {
// Only include administrative callbacks if we are viewing an admin page.
if (arg(0) == 'admin') {
include_once './' . drupal_get_path('module', 'content') . '/content_admin.inc';
}
// Unconditionally include css exactly once per page.
drupal_add_css(drupal_get_path('module', 'content') . '/content.css');
}
$items = array();
$access = user_access('administer content types');
if ($may_cache) {
$items[] = array(
'path' => 'admin/content/types/fields',
'title' => t('Fields'),
'callback' => '_content_admin_type_fields',
'access' => $access,
'type' => MENU_LOCAL_TASK,
);
}
else {
if (arg(0) == 'admin' && arg(1) == 'content' && arg(2) == 'types') {
$content_type = content_types(arg(3));
$type = node_get_types('type', $content_type['type']);
if (!empty($type) && arg(3) && arg(3) == $content_type['url_str']) {
$items[] = array(
'path' => 'admin/content/types/' . $content_type['url_str'] . '/edit',
'title' => t('Edit'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'node_type_form',
$type,
),
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items[] = array(
'path' => 'admin/content/types/' . $content_type['url_str'] . '/fields',
'title' => t('Manage fields'),
'callback' => 'drupal_get_form',
'access' => $access,
'callback arguments' => array(
'content_admin_field_overview_form',
$content_type['type'],
),
'type' => MENU_LOCAL_TASK,
'weight' => 0,
);
$items[] = array(
'path' => 'admin/content/types/' . $content_type['url_str'] . '/display',
'title' => t('Display fields'),
'callback' => 'drupal_get_form',
'access' => $access,
'callback arguments' => array(
'content_admin_display_overview_form',
$content_type['type'],
),
'type' => MENU_LOCAL_TASK,
'weight' => 1,
);
$items[] = array(
'path' => 'admin/content/types/' . $content_type['url_str'] . '/add_field',
'title' => t('Add field'),
'callback' => '_content_admin_field_add',
'access' => $access,
'callback arguments' => array(
$content_type['type'],
),
'type' => MENU_LOCAL_TASK,
'weight' => 2,
);
if (arg(4) == 'fields' && arg(5) && isset($content_type['fields'][arg(5)])) {
$items[] = array(
'path' => 'admin/content/types/' . $content_type['url_str'] . '/fields/' . arg(5),
'title' => t($content_type['fields'][arg(5)]['widget']['label']),
'callback' => 'drupal_get_form',
'access' => $access,
'callback arguments' => array(
'_content_admin_field',
$content_type['type'],
arg(5),
),
'type' => MENU_CALLBACK,
);
$items[] = array(
'path' => 'admin/content/types/' . $content_type['url_str'] . '/fields/' . arg(5) . '/remove',
'title' => t('Remove field'),
'callback' => 'drupal_get_form',
'access' => $access,
'callback arguments' => array(
'_content_admin_field_remove',
$content_type['type'],
arg(5),
),
'type' => MENU_CALLBACK,
);
}
}
}
}
return $items;
}