1 filter.admin.inc filter_admin_format_filter_settings_form($form, &$form_state, $format, $filter_name)

Returns the configuration form for an individual configurable filter.

File

core/modules/filter/filter.admin.inc, line 531
Admin page callbacks for the Filter module.

Code

function filter_admin_format_filter_settings_form($form, &$form_state, $format, $filter_name) {
  form_load_include($form_state, 'inc', 'filter', 'filter.admin');
  $form_state['format'] = $format;
  $form_state['filter_name'] = $filter_name;

  // Use a format stored in tempstore if available.
  // Has to get loaded again here in case we did not come here via ajax.
  if ($stored_format = filter_get_format_tempstore($format->format)) {
    $form_state['format'] = $stored_format;
    $format = $stored_format;
  }
  $all_filter_info = filter_get_filters();
  $filter_info = $all_filter_info[$filter_name];
  $filter = $format->filters[$filter_name];

  if (isset($filter_info['settings callback'])) {
    $function = $filter_info['settings callback'];
    $settings_form = $function($form, $form_state, $filter, $format);
  }

  $settings_form['filter'] = array(
    '#type' => 'value',
    '#value' => $filter->name,
  );
  $settings_form['actions']['#type'] = 'actions';
  $settings_form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Update'),
    '#validate' => array(),
    '#submit' => array('filter_admin_format_filter_settings_update'),
    '#ajax' => array(
      'callback' => 'filter_admin_format_filter_settings_ajax',
      'progress' => array(
        'type' => 'throbber',
        'message' => NULL,
      ),
    ),
  );

  $settings_form['actions']['cancel'] = array(
    '#type' => 'link',
    '#title' => t('Cancel'),
    '#href' => '',
    '#attributes' => array(
      // Adding button classes puts the link in the button area of the dialog,
      // while the special "dialog-cancel" class closes the dialog.
      'class' => array('button', 'button-secondary', 'form-submit', 'dialog-cancel'),
    ),
  );

  return $settings_form;
}