You are here

private function RulesWebformEventBase::extractcompositeSubmissionData in RULES WEBFORM 3.x

Same name and namespace in other branches
  1. 8 src/Event/RulesWebformEventBase.php \Drupal\rules_webform\Event\RulesWebformEventBase::extractcompositeSubmissionData()

Extract fields values of the submitted webform.

Return value

array The webform fields values.

1 call to RulesWebformEventBase::extractcompositeSubmissionData()
RulesWebformEventBase::__construct in src/Event/RulesWebformEventBase.php
Сonstructs the object.

File

src/Event/RulesWebformEventBase.php, line 106

Class

RulesWebformEventBase
Base class for events available in the 'RULES WEBFORM' module.

Namespace

Drupal\rules_webform\Event

Code

private function extractcompositeSubmissionData(array $submissionData) {
  $webform_fields = [];
  foreach ($submissionData as $key => $value) {
    if (is_array($value)) {
      $this
        ->extractcompositeSubmissionData($value);
    }
    else {

      // If a user will submit an empty webform which contents composite
      // element, then value of this composite element can be 'NULL'.
      // Make the check to prevent adding such item to the webform_fields
      // array.
      if (isset($value)) {
        $webform_fields[$key] = $value;
      }
    }
  }
  return $webform_fields;
}