You are here

public function FieldLayoutEntityDisplayFormTrait::submitForm in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/field_layout/src/Form/FieldLayoutEntityDisplayFormTrait.php \Drupal\field_layout\Form\FieldLayoutEntityDisplayFormTrait::submitForm()

Overrides \Drupal\field_ui\Form\EntityDisplayFormBase::submitForm().

File

core/modules/field_layout/src/Form/FieldLayoutEntityDisplayFormTrait.php, line 158

Class

FieldLayoutEntityDisplayFormTrait
Provides shared code for entity display forms.

Namespace

Drupal\field_layout\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  parent::submitForm($form, $form_state);
  $entity = $this
    ->getEntity();
  $layout_plugin = $this
    ->getLayout($entity, $form_state);
  if ($layout_plugin instanceof PluginFormInterface) {
    $subform_state = SubformState::createForSubform($form['field_layouts']['settings_wrapper']['layout_settings'], $form, $form_state);
    $layout_plugin
      ->submitConfigurationForm($form['field_layouts']['settings_wrapper']['layout_settings'], $subform_state);
  }
  $entity
    ->setLayout($layout_plugin);
}