public function OEmbedProcessor::provideSettings in Gutenberg 8.2
Returns a block processor's settings array.
It shouldn't modify the $form array.
Parameters
array $form: A minimally prepopulated form array.
\Drupal\Core\Form\FormStateInterface $form_state: The state of the (entire) configuration form.
Return value
array The $form array with additional form elements for the settings of this processor. The form values should match $this->defaultConfiguration().
Overrides ConfigurableProcessorBase::provideSettings
File
- src/
BlockProcessor/ OEmbedProcessor.php, line 174  
Class
- OEmbedProcessor
 - Processes oEmbed blocks.
 
Namespace
Drupal\gutenberg\BlockProcessorCode
public function provideSettings(array $form, FormStateInterface $form_state) {
  $settings['oembed'] = [
    '#type' => 'details',
    '#title' => $this
      ->t('oEmbed settings'),
    '#weight' => 10,
    '#open' => TRUE,
  ];
  if (!$this->moduleHandler
    ->moduleExists('media')) {
    $settings['oembed']['#description'] = $this
      ->t('<b>Note:</b> The %media_module module is currently uninstalled, we recommended enabling it for improved oEmbed support.', [
      '%media_module' => $this->moduleHandler
        ->getName('media'),
    ]);
  }
  $settings['oembed']['providers'] = [
    '#type' => 'textarea',
    '#title' => $this
      ->t('Providers'),
    '#default_value' => $this->settings['oembed']['providers'],
    '#description' => $this
      ->t('A list of oEmbed providers. Add your own by adding a new line using the following pattern: <br/><code>[Url to match] | [oEmbed endpoint] | [Use regex (true or false)]</code>'),
  ];
  $settings['oembed']['maxwidth'] = [
    '#type' => 'number',
    '#title' => $this
      ->t('Maximum width of media embed'),
    '#field_suffix' => $this
      ->t('pixels'),
    '#min' => 0,
    '#size' => 5,
    '#maxlength' => 5,
    '#required' => TRUE,
    '#default_value' => $this->settings['oembed']['maxwidth'],
    '#description' => $this
      ->t('The maximum width of an embedded media, in pixels.'),
  ];
  return $settings;
}