You are here

public function SoEmbedFilter::settingsForm in Simple oEmbed 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Filter/SoEmbedFilter.php \Drupal\soembed\Plugin\Filter\SoEmbedFilter::settingsForm()

Define settings for text filter.

Overrides FilterBase::settingsForm

File

src/Plugin/Filter/SoEmbedFilter.php, line 151

Class

SoEmbedFilter
Plugin annotation @Filter( id = "filter_soembed", title = @Translation("Simple oEmbed filter"), description = @Translation("Embeds media for URL that supports oEmbed standard."), settings = { "soembed_maxwidth" = 500, …

Namespace

Drupal\soembed\Plugin\Filter

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
  $form['soembed_providers'] = [
    '#type' => 'textarea',
    '#title' => $this
      ->t('Providers'),
    '#default_value' => $this->settings['soembed_providers'],
    '#description' => $this
      ->t('A list of oEmbed providers. Add your own by adding a new line and using this pattern: [Url to match] | [oEmbed endpoint] | [Use regex (true or false)]'),
  ];
  $form['soembed_maxwidth'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Maximum width of media embed'),
    '#default_value' => $this->settings['soembed_maxwidth'],
    '#description' => $this
      ->t('Set the maximum width of an embedded media. The unit is in pixels, but only put a number in the textbox.'),
  ];
  $form['soembed_replace_inline'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Replace in-line URLs'),
    '#default_value' => $this->settings['soembed_replace_inline'],
    '#description' => $this
      ->t('If this option is checked, the filter will recognize URLs even when they are not on their own lines.'),
  ];
  return $form;
}