You are here

public function Entity::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 EmbedTypeBase::submitConfigurationForm

File

src/Plugin/EmbedType/Entity.php, line 205

Class

Entity
Entity embed type.

Namespace

Drupal\entity_embed\Plugin\EmbedType

Code

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

  // Filter down the bundles and allowed Entity Embed Display plugins.
  $bundles = $form_state
    ->getValue('bundles');
  $form_state
    ->setValue('bundles', array_keys(array_filter($bundles)));
  $display_plugins = $form_state
    ->getValue('display_plugins');
  $form_state
    ->setValue('display_plugins', array_keys(array_filter($display_plugins)));
  $entity_browser = $form_state
    ->getValue('entity_browser') == '_none' ? '' : $form_state
    ->getValue('entity_browser');
  $form_state
    ->setValue('entity_browser', $entity_browser);
  $form_state
    ->setValue('entity_browser_settings', $form_state
    ->getValue('entity_browser_settings', []));
  parent::submitConfigurationForm($form, $form_state);
}