/** * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state) { $config = $this->config('pathologic.settings'); $form['reminder'] = array('#type' => 'markup', '#markup' => '<p>' . $this->t('Reminder: The settings on this form only affect text formats for which Pathologic is configured to use the global Pathologic settings; if it’s configured to use per-format settings, these settings will have no effect.') . '</p>', '#weight' => 0); $defaults = array('protocol_style' => $config->get('protocol_style'), 'local_paths' => $config->get('local_paths')); $common = new PathologicSettingsCommon(); $form += $common->commonSettingsForm($defaults); return parent::buildForm($form, $form_state); }
/** * {@inheritdoc} */ public function settingsForm(array $form, FormStateInterface $form_state) { $form['reminder'] = array('#type' => 'markup', '#markup' => $this->t('In most cases, Pathologic should be the <em>last</em> filter in the “Filter processing order” list.'), '#weight' => 0); $form['settings_source'] = array('#type' => 'radios', '#title' => $this->t('Settings source'), '#description' => $this->t('Select whether Pathologic should use the <a href=":config">global Pathologic settings</a> or custom “local” settings when filtering text in this text format.', array(':config' => Url::fromRoute('pathologic.config_form')->toString())), '#weight' => 10, '#default_value' => $this->settings['settings_source'], '#options' => array('global' => $this->t('Use global Pathologic settings'), 'local' => $this->t('Use custom settings for this text format'))); // Fields in fieldsets are… awkward to implement. // @see https://www.drupal.org/node/2378437 $form['local_settings'] = array('#type' => 'fieldset', '#title' => $this->t('Custom settings for this text format'), '#weight' => 20, '#collapsible' => FALSE, '#collapsed' => FALSE, '#description' => $this->t('These settings are ignored if “Use global Pathologic settings” is selected above.'), '#states' => array('visible' => array(':input[name="filters[filter_pathologic][settings][settings_source]"]' => array('value' => 'local')))); $common = new PathologicSettingsCommon(); $form['local_settings'] += $common->commonSettingsForm($this->settings['local_settings']); return $form; }