You are here

public function ImageFieldFormatter::submitConfigurationForm in Entity Embed 8

Form submission handler.

Parameters

array $form: An associative array containing the structure of the plugin form as built by static::buildConfigurationForm().

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form. Calling code should pass on a subform state created through \Drupal\Core\Form\SubformState::createForSubform().

Overrides EntityEmbedDisplayBase::submitConfigurationForm

File

src/Plugin/entity_embed/EntityEmbedDisplay/ImageFieldFormatter.php, line 211

Class

ImageFieldFormatter
Entity Embed Display reusing image field formatters.

Namespace

Drupal\entity_embed\Plugin\entity_embed\EntityEmbedDisplay

Code

public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {

  // When the alt attribute is set to two double quotes, transform it to the
  // empty string: two double quotes signify "empty alt attribute". See above.
  if (trim($form_state
    ->getValue([
    'attributes',
    'alt',
  ])) === MediaImageDecorator::EMPTY_STRING) {
    $form_state
      ->setValue([
      'attributes',
      'alt',
    ], '');
  }
}