You are here

protected function SettingsWebformHandler::getSubmissionSettingsOverride in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Plugin/WebformHandler/SettingsWebformHandler.php \Drupal\webform\Plugin\WebformHandler\SettingsWebformHandler::getSubmissionSettingsOverride()

Get webform submission's overridden settings.

Replaces submissions token values and cast booleans and integers.

Parameters

\Drupal\webform\WebformSubmissionInterface $webform_submission: A webform submission.

Return value

array An associative array containing overridden settings.

2 calls to SettingsWebformHandler::getSubmissionSettingsOverride()
SettingsWebformHandler::displayDebug in src/Plugin/WebformHandler/SettingsWebformHandler.php
Display debugging information about the current action.
SettingsWebformHandler::overrideSettings in src/Plugin/WebformHandler/SettingsWebformHandler.php
Alter/override a webform submission webform settings.

File

src/Plugin/WebformHandler/SettingsWebformHandler.php, line 376

Class

SettingsWebformHandler
Webform submission settings handler.

Namespace

Drupal\webform\Plugin\WebformHandler

Code

protected function getSubmissionSettingsOverride(WebformSubmissionInterface $webform_submission) {
  $settings_definitions = $this
    ->getSettingsDefinitions();
  $settings_override = $this
    ->getSettingsOverride();
  foreach ($settings_override as $name => $value) {
    if (!isset($settings_definitions[$name])) {
      continue;
    }

    // Replace token value and cast booleans and integers.
    $type = $settings_definitions[$name]['type'];
    if (in_array($type, [
      'boolean',
      'integer',
    ])) {
      $value = $this
        ->replaceTokens($value, $webform_submission);
      settype($value, $type);
      $settings_override[$name] = $value;
    }
  }
  return $settings_override;
}