You are here

public function PluginConfigurationFormTrait::submitConfigurationForm in Entity Browser 8

Same name and namespace in other branches
  1. 8.2 src/PluginConfigurationFormTrait.php \Drupal\entity_browser\PluginConfigurationFormTrait::submitConfigurationForm()

Implements PluginFormInterface::submitConfigurationForm().

This is the default implementation for the most common cases where the form element names match keys in configuration array. Plugins can override this if they need more complex logic.

1 call to PluginConfigurationFormTrait::submitConfigurationForm()
EntityForm::submitConfigurationForm in modules/entity_form/src/Plugin/EntityBrowser/Widget/EntityForm.php
Implements PluginFormInterface::submitConfigurationForm().
3 methods override PluginConfigurationFormTrait::submitConfigurationForm()
EntityForm::submitConfigurationForm in modules/entity_form/src/Plugin/EntityBrowser/Widget/EntityForm.php
Implements PluginFormInterface::submitConfigurationForm().
View::submitConfigurationForm in src/Plugin/EntityBrowser/SelectionDisplay/View.php
Implements PluginFormInterface::submitConfigurationForm().
View::submitConfigurationForm in src/Plugin/EntityBrowser/Widget/View.php
Implements PluginFormInterface::submitConfigurationForm().

File

src/PluginConfigurationFormTrait.php, line 32

Class

PluginConfigurationFormTrait
Provides base form methods for configurable plugins entity browser.

Namespace

Drupal\entity_browser

Code

public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
  $values = $form_state
    ->getValues();
  if ($this instanceof WidgetInterface) {
    $values = $values['table'][$this
      ->uuid()]['form'];
  }
  if (!empty($values)) {
    foreach ($values as $key => $value) {
      if (array_key_exists($key, $this->configuration)) {
        $this->configuration[$key] = $value;
      }
    }
  }
}