public function YamlFormCompositeBase::buildExportRecord in YAML Form 8
Build an element's export row.
Parameters
array $element: An element.
array $export_options: An associative array of export options.
Return value
array An array containing the element's export row.
Overrides YamlFormElementBase::buildExportRecord
See also
\Drupal\yamlform\YamlFormSubmissionExporterInterface::getDefaultExportOptions
File
- src/
Plugin/ YamlFormElement/ YamlFormCompositeBase.php, line 574
Class
- YamlFormCompositeBase
- Provides a base for composite elements.
Namespace
Drupal\yamlform\Plugin\YamlFormElementCode
public function buildExportRecord(array $element, $value, array $export_options) {
$record = [];
$composite_elements = $this
->getInitializedCompositeElement($element);
foreach (RenderElement::children($composite_elements) as $composite_key) {
$composite_element = $composite_elements[$composite_key];
if (isset($composite_element['#access']) && $composite_element['#access'] === FALSE) {
continue;
}
if ($export_options['composite_element_item_format'] == 'label' && $composite_element['#type'] != 'textfield' && !empty($composite_element['#options'])) {
$record[] = YamlFormOptionsHelper::getOptionText($value[$composite_key], $composite_element['#options']);
}
else {
$record[] = isset($value[$composite_key]) ? $value[$composite_key] : NULL;
}
}
return $record;
}