You are here

protected function WebformUiOptionsForm::copyFormValuesToEntity in Webform 6.x

Same name and namespace in other branches
  1. 8.5 modules/webform_ui/src/WebformUiOptionsForm.php \Drupal\webform_ui\WebformUiOptionsForm::copyFormValuesToEntity()

Copies top-level form values to entity properties.

This should not change existing entity properties that are not being edited by this form.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity the current form should operate upon.

array $form: A nested array of form elements comprising the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides EntityForm::copyFormValuesToEntity

File

modules/webform_ui/src/WebformUiOptionsForm.php, line 49

Class

WebformUiOptionsForm
Base for controller for webform option UI.

Namespace

Drupal\webform_ui

Code

protected function copyFormValuesToEntity(EntityInterface $entity, array $form, FormStateInterface $form_state) {
  $values = $form_state
    ->getValues();
  if (is_array($values['options'])) {
    $entity
      ->setOptions($values['options']);
    unset($values['options']);
  }
  foreach ($values as $key => $value) {
    $entity
      ->set($key, $value);
  }
}