You are here

public function OptionsLimitWebformHandler::submitConfigurationForm in Webform 6.x

Same name and namespace in other branches
  1. 8.5 modules/webform_options_limit/src/Plugin/WebformHandler/OptionsLimitWebformHandler.php \Drupal\webform_options_limit\Plugin\WebformHandler\OptionsLimitWebformHandler::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

File

modules/webform_options_limit/src/Plugin/WebformHandler/OptionsLimitWebformHandler.php, line 438

Class

OptionsLimitWebformHandler
Webform options and boolean (boolean) limit handler.

Namespace

Drupal\webform_options_limit\Plugin\WebformHandler

Code

public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
  parent::submitConfigurationForm($form, $form_state);
  $this
    ->applyFormStateToConfiguration($form_state);
  foreach ($this->configuration['limits'] as $key => $value) {
    if ($value === '') {
      unset($this->configuration['limits'][$key]);
    }
    else {
      $this->configuration['limits'][$key] = (int) $value;
    }
  }
  if ($this
    ->isOptionsElement()) {
    $this->configuration['limit'] = NULL;
  }
  else {
    $this->configuration['limits'] = [];
  }
}