summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/filter/filter.admin.inc38
-rw-r--r--modules/filter/filter.module18
2 files changed, 44 insertions, 12 deletions
diff --git a/modules/filter/filter.admin.inc b/modules/filter/filter.admin.inc
index a25082a2b..697e631ca 100644
--- a/modules/filter/filter.admin.inc
+++ b/modules/filter/filter.admin.inc
@@ -74,13 +74,27 @@ function theme_filter_admin_overview($form) {
}
/**
+ * 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.
*
* @ingroup forms
* @see filter_admin_format_form_validate().
* @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));
if ($default) {
$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),
);
}
- if (isset($format)) {
+ if (!empty($format->format)) {
$form['format'] = array('#type' => 'hidden', '#value' => $format->format);
// 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 .= $tiplist;
$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'));
@@ -271,8 +284,17 @@ function filter_admin_delete_submit($form, &$form_state) {
return;
}
+
+/**
+ * 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);
+}
+
/**
- * Menu callback; display settings defined by filters.
+ * Build a form to change the settings for a format's filters.
*
* @ingroup forms
*/
@@ -298,6 +320,14 @@ function filter_admin_configure(&$form_state, $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
* @see theme_filter_admin_order().
diff --git a/modules/filter/filter.module b/modules/filter/filter.module
index 8b0244146..d392831e4 100644
--- a/modules/filter/filter.module
+++ b/modules/filter/filter.module
@@ -87,10 +87,10 @@ function filter_menu() {
);
$items['admin/settings/filters/add'] = array(
'title' => 'Add input format',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('filter_admin_format_form'),
+ 'page callback' => 'filter_admin_format_page',
'type' => MENU_LOCAL_TASK,
'weight' => 1,
+ 'file' => 'filter.admin.inc',
);
$items['admin/settings/filters/delete'] = array(
'title' => 'Delete input format',
@@ -108,28 +108,30 @@ function filter_menu() {
);
$items['admin/settings/filters/%filter_format'] = array(
'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'),
'file' => 'filter.admin.inc',
);
- $items['admin/settings/filters/%filter_format/list'] = array(
- 'title' => 'View',
- 'page arguments' => array('filter_admin_format_form', 3),
+ $items['admin/settings/filters/%filter_format/edit'] = array(
+ 'title' => 'Edit',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => 0,
'file' => 'filter.admin.inc',
);
$items['admin/settings/filters/%filter_format/configure'] = array(
'title' => 'Configure',
- 'page arguments' => array('filter_admin_configure', 3),
+ 'page callback' => 'filter_admin_configure_page',
+ 'page arguments' => array(3),
'type' => MENU_LOCAL_TASK,
'weight' => 1,
'file' => 'filter.admin.inc',
);
$items['admin/settings/filters/%filter_format/order'] = array(
'title' => 'Rearrange',
- 'page arguments' => array('filter_admin_order', 3),
+ 'page callback' => 'filter_admin_order_page',
+ 'page arguments' => array(3),
'type' => MENU_LOCAL_TASK,
'weight' => 2,
'file' => 'filter.admin.inc',