1 filter.api.php callback_filter_settings($form, &$form_state, $filter, $format)

Provide a settings form for filter settings.

Callback for hook_filter_info().

This callback function is used to provide a settings form for filter settings, for filters that need settings on a per-text-format basis. This function should return the form elements for the settings; the filter module will take care of saving the settings in the database.

If the filter's behavior depends on an extensive list and/or external data (e.g. a list of smileys, a list of glossary terms), then the filter module can choose to provide a separate, global configuration page rather than per-text-format settings. In that case, the settings callback function should provide a link to the separate settings page.

Parameters

$form: The prepopulated form array of the filter administration form.

$form_state: The state of the (entire) configuration form.

$filter: The filter array containing the current settings for the given format, in $filter['settings'].

$format: The format object being configured.

Return value

An array of form elements defining settings for the filter. Array keys: should match the array keys in $filter->settings and $defaults.

Related topics

File

core/modules/filter/filter.api.php, line 232
Hooks provided by the Filter module.

Code

function callback_filter_settings($form, &$form_state, $filter, $format) {
  $elements = array();
  $elements['nofollow'] = array(
    '#type' => 'checkbox',
    '#title' => t('Add rel="nofollow" to all links'),
    '#default_value' => $filter->settings['nofollow'],
  );
  return $elements;
}