You are here

public function YamlFormCompositeBase::getTestValue in YAML Form 8

Get test value for an element.

Parameters

array $element: An element.

\Drupal\yamlform\YamlFormInterface $yamlform: A form.

Return value

mixed A test value for an element.

Overrides YamlFormElementBase::getTestValue

1 method overrides YamlFormCompositeBase::getTestValue()
YamlFormLocation::getTestValue in src/Plugin/YamlFormElement/YamlFormLocation.php
Get test value for an element.

File

src/Plugin/YamlFormElement/YamlFormCompositeBase.php, line 596

Class

YamlFormCompositeBase
Provides a base for composite elements.

Namespace

Drupal\yamlform\Plugin\YamlFormElement

Code

public function getTestValue(array $element, YamlFormInterface $yamlform) {

  /** @var \Drupal\yamlform\YamlFormSubmissionGenerateInterface $generate */
  $generate = \Drupal::service('yamlform_submission.generate');
  $value = [];
  $composite_elements = $this
    ->getInitializedCompositeElement($element);
  foreach (RenderElement::children($composite_elements) as $composite_key) {
    $value[$composite_key] = $generate
      ->getTestValue($yamlform, $composite_key, $composite_elements[$composite_key]);
  }
  return [
    $value,
  ];
}