You are here

public function EmailWebformHandler::submitConfigurationForm in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Plugin/WebformHandler/EmailWebformHandler.php \Drupal\webform\Plugin\WebformHandler\EmailWebformHandler::submitConfigurationForm()

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 WebformHandlerBase::submitConfigurationForm

1 call to EmailWebformHandler::submitConfigurationForm()
ScheduleEmailWebformHandler::submitConfigurationForm in modules/webform_scheduled_email/src/Plugin/WebformHandler/ScheduleEmailWebformHandler.php
Form submission handler.
1 method overrides EmailWebformHandler::submitConfigurationForm()
ScheduleEmailWebformHandler::submitConfigurationForm in modules/webform_scheduled_email/src/Plugin/WebformHandler/ScheduleEmailWebformHandler.php
Form submission handler.

File

src/Plugin/WebformHandler/EmailWebformHandler.php, line 868

Class

EmailWebformHandler
Emails a webform submission.

Namespace

Drupal\webform\Plugin\WebformHandler

Code

public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
  parent::submitConfigurationForm($form, $form_state);
  $values = $form_state
    ->getValues();

  // Cleanup states.
  $values['states'] = array_values(array_filter($values['states']));
  foreach ($this->configuration as $name => $value) {
    if (isset($values[$name])) {

      // Convert options array to safe config array to prevent errors.
      // @see https://www.drupal.org/node/2297311
      if (preg_match('/_options$/', $name)) {
        $this->configuration[$name] = WebformOptionsHelper::encodeConfig($values[$name]);
      }
      else {
        $this->configuration[$name] = $values[$name];
      }
    }
  }

  // Cast debug.
  $this->configuration['debug'] = (bool) $this->configuration['debug'];
}