#175779 by pwolanin: fix filter format addition page and add proper titles for filter configuration tabs

6.x
Gábor Hojtsy 2007-09-17 09:16:48 +00:00
parent 7a4612ca3e
commit 44697397b7
2 changed files with 44 additions and 12 deletions

View File

@ -73,6 +73,20 @@ function theme_filter_admin_overview($form) {
return $output; return $output;
} }
/**
* Display a filter format form.
*/
function filter_admin_format_page($format = NULL) {
if (!isset($format->name)) {
drupal_set_title(t("Add input format"));
$format = (object)array('name' => '', 'roles' => '', 'format' => '');
}
else {
drupal_set_title(t("%format input format", array('%format' => $format->name)));
}
return drupal_get_form('filter_admin_format_form', $format);
}
/** /**
* Generate a filter format form. * Generate a filter format form.
* *
@ -80,7 +94,7 @@ function theme_filter_admin_overview($form) {
* @see filter_admin_format_form_validate(). * @see filter_admin_format_form_validate().
* @see filter_admin_format_form_submit(). * @see filter_admin_format_form_submit().
*/ */
function filter_admin_format_form(&$form_state, $format = NULL) { function filter_admin_format_form(&$form_state, $format) {
$default = ($format->format == variable_get('filter_default_format', 1)); $default = ($format->format == variable_get('filter_default_format', 1));
if ($default) { if ($default) {
$help = t('All roles for the default format must be enabled and cannot be changed.'); $help = t('All roles for the default format must be enabled and cannot be changed.');
@ -127,7 +141,7 @@ function filter_admin_format_form(&$form_state, $format = NULL) {
'#description' => module_invoke($filter->module, 'filter', 'description', $filter->delta), '#description' => module_invoke($filter->module, 'filter', 'description', $filter->delta),
); );
} }
if (isset($format)) { if (!empty($format->format)) {
$form['format'] = array('#type' => 'hidden', '#value' => $format->format); $form['format'] = array('#type' => 'hidden', '#value' => $format->format);
// Composition tips (guidelines) // Composition tips (guidelines)
@ -140,7 +154,6 @@ function filter_admin_format_form(&$form_state, $format = NULL) {
$group = '<p>'. t('These are the guidelines that users will see for posting in this input format. They are automatically generated from the filter settings.') .'</p>'; $group = '<p>'. t('These are the guidelines that users will see for posting in this input format. They are automatically generated from the filter settings.') .'</p>';
$group .= $tiplist; $group .= $tiplist;
$form['tips'] = array('#value' => '<h2>'. t('Formatting guidelines') .'</h2>'. $group); $form['tips'] = array('#value' => '<h2>'. t('Formatting guidelines') .'</h2>'. $group);
drupal_set_title(t("!format input format", array('!format' => $format->name)));
} }
$form['submit'] = array('#type' => 'submit', '#value' => t('Save configuration')); $form['submit'] = array('#type' => 'submit', '#value' => t('Save configuration'));
@ -271,8 +284,17 @@ function filter_admin_delete_submit($form, &$form_state) {
return; return;
} }
/** /**
* Menu callback; display settings defined by filters. * Menu callback; display settings defined by a format's filters.
*/
function filter_admin_configure_page($format) {
drupal_set_title(t("Configure %format", array('%format' => $format->name)));
return drupal_get_form('filter_admin_configure', $format);
}
/**
* Build a form to change the settings for a format's filters.
* *
* @ingroup forms * @ingroup forms
*/ */
@ -298,6 +320,14 @@ function filter_admin_configure(&$form_state, $format) {
/** /**
* Menu callback; display form for ordering filters for a format. * Menu callback; display form for ordering filters for a format.
*/
function filter_admin_order_page($format) {
drupal_set_title(t("Rearrange %format", array('%format' => $format->name)));
return drupal_get_form('filter_admin_order', $format);
}
/**
* Build the form for ordering filters for a format.
* *
* @ingroup forms * @ingroup forms
* @see theme_filter_admin_order(). * @see theme_filter_admin_order().

View File

@ -87,10 +87,10 @@ function filter_menu() {
); );
$items['admin/settings/filters/add'] = array( $items['admin/settings/filters/add'] = array(
'title' => 'Add input format', 'title' => 'Add input format',
'page callback' => 'drupal_get_form', 'page callback' => 'filter_admin_format_page',
'page arguments' => array('filter_admin_format_form'),
'type' => MENU_LOCAL_TASK, 'type' => MENU_LOCAL_TASK,
'weight' => 1, 'weight' => 1,
'file' => 'filter.admin.inc',
); );
$items['admin/settings/filters/delete'] = array( $items['admin/settings/filters/delete'] = array(
'title' => 'Delete input format', 'title' => 'Delete input format',
@ -108,28 +108,30 @@ function filter_menu() {
); );
$items['admin/settings/filters/%filter_format'] = array( $items['admin/settings/filters/%filter_format'] = array(
'type' => MENU_CALLBACK, 'type' => MENU_CALLBACK,
'page arguments' => array('filter_admin_format_form', 3), 'page callback' => 'filter_admin_format_page',
'page arguments' => array(3),
'access arguments' => array('administer filters'), 'access arguments' => array('administer filters'),
'file' => 'filter.admin.inc', 'file' => 'filter.admin.inc',
); );
$items['admin/settings/filters/%filter_format/list'] = array( $items['admin/settings/filters/%filter_format/edit'] = array(
'title' => 'View', 'title' => 'Edit',
'page arguments' => array('filter_admin_format_form', 3),
'type' => MENU_DEFAULT_LOCAL_TASK, 'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => 0, 'weight' => 0,
'file' => 'filter.admin.inc', 'file' => 'filter.admin.inc',
); );
$items['admin/settings/filters/%filter_format/configure'] = array( $items['admin/settings/filters/%filter_format/configure'] = array(
'title' => 'Configure', 'title' => 'Configure',
'page arguments' => array('filter_admin_configure', 3), 'page callback' => 'filter_admin_configure_page',
'page arguments' => array(3),
'type' => MENU_LOCAL_TASK, 'type' => MENU_LOCAL_TASK,
'weight' => 1, 'weight' => 1,
'file' => 'filter.admin.inc', 'file' => 'filter.admin.inc',
); );
$items['admin/settings/filters/%filter_format/order'] = array( $items['admin/settings/filters/%filter_format/order'] = array(
'title' => 'Rearrange', 'title' => 'Rearrange',
'page arguments' => array('filter_admin_order', 3), 'page callback' => 'filter_admin_order_page',
'page arguments' => array(3),
'type' => MENU_LOCAL_TASK, 'type' => MENU_LOCAL_TASK,
'weight' => 2, 'weight' => 2,
'file' => 'filter.admin.inc', 'file' => 'filter.admin.inc',