protected function WebformCompositeBase::getManagedFileIdsFromData in Webform 8.5
Same name and namespace in other branches
- 6.x src/Plugin/WebformElement/WebformCompositeBase.php \Drupal\webform\Plugin\WebformElement\WebformCompositeBase::getManagedFileIdsFromData()
Get composite element's file ids from data array.
Parameters
array $element: A composite element.
array $data: A submission data array.
string $composite_key: The composite sub-element key.
Return value
array An array of file ids.
2 calls to WebformCompositeBase::getManagedFileIdsFromData()
- WebformCompositeBase::getAttachments in src/
Plugin/ WebformElement/ WebformCompositeBase.php - Get email attachments.
- WebformCompositeBase::postSave in src/
Plugin/ WebformElement/ WebformCompositeBase.php - Acts on a saved webform submission element before the insert or update hook is invoked.
File
- src/
Plugin/ WebformElement/ WebformCompositeBase.php, line 1373
Class
- WebformCompositeBase
- Provides a base for composite elements.
Namespace
Drupal\webform\Plugin\WebformElementCode
protected function getManagedFileIdsFromData(array $element, array $data, $composite_key) {
$element_key = $element['#webform_key'];
if (empty($data[$element_key])) {
return [];
}
$fids = [];
$items = $this
->hasMultipleValues($element) ? $data[$element_key] : [
$data[$element_key],
];
foreach ($items as $item) {
if (!empty($item[$composite_key])) {
$fids[] = $item[$composite_key];
}
}
return $fids;
}