1 filter.admin.inc filter_admin_format_filter_settings_ajax($form, &$form_state)

Ajax handler for buttons in filter_admin_format_filter_settings_form().

File

core/modules/filter/filter.admin.inc, line 591
Administrative page callbacks for the Filter module.

Code

function filter_admin_format_filter_settings_ajax($form, &$form_state) {
  $filter_name = $form_state['filter_name'];
  $format = $form_state['format'];

  $commands = array();

  // Update the filter tips for the configured filter.
  $cloned_format = clone($format);
  $cloned_format->editor = FALSE;
  $tips = _filter_admin_format_get_tips($format, $filter_name);
  if (isset($tips)) {
    $commands[] = ajax_command_html('.filter-info[data-filter-name="' . $filter_name . '"] .description', $tips);
  }

  if (isset($form_state['values']['allowed_html'])) {
    // Update the tag list stored in the main form hidden element.
    $commands[] = ajax_command_invoke('#allowed-html', 'val', array($form_state['values']['allowed_html']));
    $commands[] = ajax_command_invoke('#allowed-html', 'trigger', array('change.filter-update'));
  }
  $commands[] = ajax_command_html('#filter-messages', theme('status_messages'));
  $commands[] = ajax_command_close_modal_dialog();
  return array('#type' => 'ajax', '#commands' => $commands);
}