You are here

function _pathologic_settings in Pathologic 7.3

Same name and namespace in other branches
  1. 7 pathologic.module \_pathologic_settings()
  2. 7.2 pathologic.module \_pathologic_settings()

Settings callback for Pathologic.

1 string reference to '_pathologic_settings'
pathologic_filter_info in ./pathologic.module
Implements hook_filter_info().

File

./pathologic.module, line 54
Pathologic text filter for Drupal.

Code

function _pathologic_settings($form, &$form_state, $filter, $format, $defaults, $filters) {

  // Puzzlingly, though we have a $form parameter, it has everything else's form
  // elements in it; we can't just modify it in place or return it modified. We
  // need to start a new form.
  $our_form = array();
  $our_form['reminder'] = array(
    '#type' => 'item',
    '#title' => t('In most cases, Pathologic should be the <em>last</em> filter in the &ldquo;Filter processing order&rdquo; list.'),
    '#weight' => 0,
  );
  $our_form['settings_source'] = array(
    '#type' => 'radios',
    '#title' => t('Settings source'),
    '#description' => t('Select whether Pathologic should use the <a href="!config">global Pathologic settings</a> or custom &ldquo;local&rdquo; settings when filtering text in this text format.', array(
      '!config' => url('admin/config/content/pathologic'),
    )),
    '#weight' => 10,
    '#default_value' => _pathologic_get_real_settings_source($format->format),
    '#options' => array(
      'global' => t('Use global Pathologic settings'),
      'local' => t('Use custom settings for this text format'),
    ),
  );
  $our_form['local_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Custom settings for this text format'),
    '#weight' => 20,
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
    '#description' => t('These settings are ignored if &ldquo;Use global Pathologic settings&rdquo; is selected above.'),
    '#states' => array(
      'visible' => array(
        ':input[name="filters[pathologic][settings][settings_source]"]' => array(
          'value' => 'local',
        ),
      ),
    ),
  );
  module_load_include('inc', 'pathologic', 'pathologic.admin');
  $settings = isset($filter->settings['local_settings']) ? $filter->settings['local_settings'] : $filter->settings;
  $our_form['local_settings'] += _pathologic_configuration_form(array(
    'protocol_style' => isset($settings['protocol_style']) ? $settings['protocol_style'] : $defaults['protocol_style'],
    'local_paths' => isset($settings['local_paths']) ? $settings['local_paths'] : $defaults['local_paths'],
  ));
  return $our_form;
}