- Patch #18045 by JonBob: the node type admin page uses an unclear callback name, and uses arg() where it is not necessary. The attached patch cleans this up by unifying node_types() with node_types_configure().
parent
a4befbb68b
commit
3123d7e6ec
|
@ -669,7 +669,7 @@ function node_menu($may_cache) {
|
|||
$items[] = array('path' => 'admin/node/configure/settings', 'title' => t('settings'),
|
||||
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
|
||||
$items[] = array('path' => 'admin/node/configure/types', 'title' => t('content types'),
|
||||
'callback' => 'node_types',
|
||||
'callback' => 'node_types_configure',
|
||||
'access' => user_access('administer nodes'),
|
||||
'type' => MENU_LOCAL_TASK);
|
||||
if (module_exist('search')) {
|
||||
|
@ -717,8 +717,6 @@ function node_menu($may_cache) {
|
|||
else if (arg(0) == 'admin' && arg(1) == 'node' && arg(2) == 'configure' && arg(3) == 'types' && is_string(arg(4))) {
|
||||
$items[] = array('path' => 'admin/node/configure/types/'. arg(4),
|
||||
'title' => t("'%name' content type", array('%name' => node_invoke(arg(4), 'node_name'))),
|
||||
'callback' => 'node_types_configure',
|
||||
'access' => user_access('administer nodes'),
|
||||
'type' => MENU_CALLBACK);
|
||||
}
|
||||
}
|
||||
|
@ -942,32 +940,34 @@ function node_admin_nodes() {
|
|||
return form($output, 'post', url('admin/node/action'));
|
||||
}
|
||||
|
||||
function node_types() {
|
||||
$header = array(t('Type'), t('Operations'));
|
||||
/**
|
||||
* Menu callback; presents each node type configuration page.
|
||||
*/
|
||||
function node_types_configure($type = NULL) {
|
||||
if (isset($type)) {
|
||||
// Go to the listing page when we submit this form, system_settings_save() calls drupal_goto().
|
||||
if ($_POST['op']) {
|
||||
$_GET['q'] = 'admin/node/configure/types';
|
||||
}
|
||||
system_settings_save();
|
||||
|
||||
$rows = array();
|
||||
foreach (node_list() as $type) {
|
||||
$rows[] = array(node_invoke($type, 'node_name'), l(t('configure'), 'admin/node/configure/types/'. $type));
|
||||
$group = form_textarea(t('Explanation or submission guidelines'), $type .'_help', variable_get($type .'_help', ''), 70, 5, t('This text will be displayed at the top of the %type submission form. It is useful for helping or instructing your users.', array('%type' => node_invoke($type, 'node_name'))));
|
||||
$group .= form_select(t('Minimum number of words'), 'minimum_'. $type .'_size', variable_get('minimum_'. $type .'_size', 0), drupal_map_assoc(array(0, 10, 25, 50, 75, 100, 125, 150, 175, 200)), t('The minimum number of words a %type must be to be considered valid. This can be useful to rule out submissions that do not meet the site\'s standards, such as short test posts.', array('%type' => node_invoke($type, 'node_name'))));
|
||||
$output = form_group(t('Submission form'), $group);
|
||||
$output .= form_group(t('Workflow'), implode('', node_invoke_nodeapi($type, 'settings')));
|
||||
|
||||
print theme('page', system_settings_form($output));
|
||||
}
|
||||
else {
|
||||
$header = array(t('Type'), t('Operations'));
|
||||
|
||||
print theme('page', theme('table', $header, $rows));
|
||||
}
|
||||
$rows = array();
|
||||
foreach (node_list() as $type) {
|
||||
$rows[] = array(node_invoke($type, 'node_name'), l(t('configure'), 'admin/node/configure/types/'. $type));
|
||||
}
|
||||
|
||||
function node_types_configure() {
|
||||
// Go to the listing page when we submit this form, system_settings_save() calls drupal_goto().
|
||||
if ($_POST['op']) {
|
||||
$_GET['q'] = 'admin/node/configure/types';
|
||||
print theme('page', theme('table', $header, $rows));
|
||||
}
|
||||
system_settings_save();
|
||||
|
||||
$type = arg(4);
|
||||
|
||||
$group = form_textarea(t('Explanation or submission guidelines'), $type .'_help', variable_get($type .'_help', ''), 70, 5, t('This text will be displayed at the top of the %type submission form. It is useful for helping or instructing your users.', array('%type' => node_invoke($type, 'node_name'))));
|
||||
$group .= form_select(t('Minimum number of words'), 'minimum_'. $type .'_size', variable_get('minimum_'. $type .'_size', 0), drupal_map_assoc(array(0, 10, 25, 50, 75, 100, 125, 150, 175, 200)), t('The minimum number of words a %type must be to be considered valid. This can be useful to rule out submissions that do not meet the site\'s standards, such as short test posts.', array('%type' => node_invoke($type, 'node_name'))));
|
||||
$output = form_group(t('Submission form'), $group);
|
||||
$output .= form_group(t('Workflow'), implode('', node_invoke_nodeapi($type, 'settings')));
|
||||
|
||||
print theme('page', system_settings_form($output));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -669,7 +669,7 @@ function node_menu($may_cache) {
|
|||
$items[] = array('path' => 'admin/node/configure/settings', 'title' => t('settings'),
|
||||
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
|
||||
$items[] = array('path' => 'admin/node/configure/types', 'title' => t('content types'),
|
||||
'callback' => 'node_types',
|
||||
'callback' => 'node_types_configure',
|
||||
'access' => user_access('administer nodes'),
|
||||
'type' => MENU_LOCAL_TASK);
|
||||
if (module_exist('search')) {
|
||||
|
@ -717,8 +717,6 @@ function node_menu($may_cache) {
|
|||
else if (arg(0) == 'admin' && arg(1) == 'node' && arg(2) == 'configure' && arg(3) == 'types' && is_string(arg(4))) {
|
||||
$items[] = array('path' => 'admin/node/configure/types/'. arg(4),
|
||||
'title' => t("'%name' content type", array('%name' => node_invoke(arg(4), 'node_name'))),
|
||||
'callback' => 'node_types_configure',
|
||||
'access' => user_access('administer nodes'),
|
||||
'type' => MENU_CALLBACK);
|
||||
}
|
||||
}
|
||||
|
@ -942,32 +940,34 @@ function node_admin_nodes() {
|
|||
return form($output, 'post', url('admin/node/action'));
|
||||
}
|
||||
|
||||
function node_types() {
|
||||
$header = array(t('Type'), t('Operations'));
|
||||
/**
|
||||
* Menu callback; presents each node type configuration page.
|
||||
*/
|
||||
function node_types_configure($type = NULL) {
|
||||
if (isset($type)) {
|
||||
// Go to the listing page when we submit this form, system_settings_save() calls drupal_goto().
|
||||
if ($_POST['op']) {
|
||||
$_GET['q'] = 'admin/node/configure/types';
|
||||
}
|
||||
system_settings_save();
|
||||
|
||||
$rows = array();
|
||||
foreach (node_list() as $type) {
|
||||
$rows[] = array(node_invoke($type, 'node_name'), l(t('configure'), 'admin/node/configure/types/'. $type));
|
||||
$group = form_textarea(t('Explanation or submission guidelines'), $type .'_help', variable_get($type .'_help', ''), 70, 5, t('This text will be displayed at the top of the %type submission form. It is useful for helping or instructing your users.', array('%type' => node_invoke($type, 'node_name'))));
|
||||
$group .= form_select(t('Minimum number of words'), 'minimum_'. $type .'_size', variable_get('minimum_'. $type .'_size', 0), drupal_map_assoc(array(0, 10, 25, 50, 75, 100, 125, 150, 175, 200)), t('The minimum number of words a %type must be to be considered valid. This can be useful to rule out submissions that do not meet the site\'s standards, such as short test posts.', array('%type' => node_invoke($type, 'node_name'))));
|
||||
$output = form_group(t('Submission form'), $group);
|
||||
$output .= form_group(t('Workflow'), implode('', node_invoke_nodeapi($type, 'settings')));
|
||||
|
||||
print theme('page', system_settings_form($output));
|
||||
}
|
||||
else {
|
||||
$header = array(t('Type'), t('Operations'));
|
||||
|
||||
print theme('page', theme('table', $header, $rows));
|
||||
}
|
||||
$rows = array();
|
||||
foreach (node_list() as $type) {
|
||||
$rows[] = array(node_invoke($type, 'node_name'), l(t('configure'), 'admin/node/configure/types/'. $type));
|
||||
}
|
||||
|
||||
function node_types_configure() {
|
||||
// Go to the listing page when we submit this form, system_settings_save() calls drupal_goto().
|
||||
if ($_POST['op']) {
|
||||
$_GET['q'] = 'admin/node/configure/types';
|
||||
print theme('page', theme('table', $header, $rows));
|
||||
}
|
||||
system_settings_save();
|
||||
|
||||
$type = arg(4);
|
||||
|
||||
$group = form_textarea(t('Explanation or submission guidelines'), $type .'_help', variable_get($type .'_help', ''), 70, 5, t('This text will be displayed at the top of the %type submission form. It is useful for helping or instructing your users.', array('%type' => node_invoke($type, 'node_name'))));
|
||||
$group .= form_select(t('Minimum number of words'), 'minimum_'. $type .'_size', variable_get('minimum_'. $type .'_size', 0), drupal_map_assoc(array(0, 10, 25, 50, 75, 100, 125, 150, 175, 200)), t('The minimum number of words a %type must be to be considered valid. This can be useful to rule out submissions that do not meet the site\'s standards, such as short test posts.', array('%type' => node_invoke($type, 'node_name'))));
|
||||
$output = form_group(t('Submission form'), $group);
|
||||
$output .= form_group(t('Workflow'), implode('', node_invoke_nodeapi($type, 'settings')));
|
||||
|
||||
print theme('page', system_settings_form($output));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue