You are here

protected function RemotePostWebformHandler::castRequestValues in Webform 8.5

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

Cast request values.

Parameters

array $element: An element.

\Drupal\webform\Plugin\WebformElementInterface $element_plugin: The element's webform plugin.

mixed $value: The element's value.

Return value

mixed The element's values cast to boolean or float when appropriate.

1 call to RemotePostWebformHandler::castRequestValues()
RemotePostWebformHandler::getRequestData in src/Plugin/WebformHandler/RemotePostWebformHandler.php
Get a webform submission's request data.

File

src/Plugin/WebformHandler/RemotePostWebformHandler.php, line 697

Class

RemotePostWebformHandler
Webform submission remote post handler.

Namespace

Drupal\webform\Plugin\WebformHandler

Code

protected function castRequestValues(array $element, WebformElementInterface $element_plugin, $value) {
  $element_plugin
    ->initialize($element);
  if ($element_plugin
    ->hasMultipleValues($element)) {
    foreach ($value as $index => $item) {
      $value[$index] = $this
        ->castRequestValue($element, $element_plugin, $item);
    }
    return $value;
  }
  else {
    return $this
      ->castRequestValue($element, $element_plugin, $value);
  }
}