You are here

function entity_browser_enhanced_submit in Entity Browser Enhance(d|r) 8

Entity browser enhanced submit.

1 string reference to 'entity_browser_enhanced_submit'
entity_browser_enhanced_form_alter in ./entity_browser_enhanced.module
Implements hook_form_alter().

File

./entity_browser_enhanced.module, line 106
Allows to have an enhanced entity browser.

Code

function entity_browser_enhanced_submit(&$form, FormStateInterface $form_state) {
  $entity_browser = $form_state
    ->getFormObject()
    ->getEntity();
  foreach ($entity_browser
    ->getWidgets() as $uuid => $widget) {
    if (!$widget instanceof View) {
      continue;
    }
    $widget_values = $form_state
      ->getValues()['table'][$widget
      ->uuid()]['form'];
    if (!empty($widget_values['enhancer'])) {
      \Drupal::service('config.factory')
        ->getEditable('entity_browser_enhanced.widgets.' . $entity_browser
        ->getName())
        ->set($uuid, $widget_values['enhancer'])
        ->save();
    }
  }
}