You are here

public function WebformCompositeBase::getManagedFiles in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Plugin/WebformElement/WebformCompositeBase.php \Drupal\webform\Plugin\WebformElement\WebformCompositeBase::getManagedFiles()

Get composite's managed file elements.

Parameters

array $element: A composite element.

Return value

array An array of managed file element keys.

3 calls to WebformCompositeBase::getManagedFiles()
WebformCompositeBase::getAttachments in src/Plugin/WebformElement/WebformCompositeBase.php
Get email attachments.
WebformCompositeBase::hasManagedFiles in src/Plugin/WebformElement/WebformCompositeBase.php
Determine if the element is or includes a managed_file upload element.
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 1408

Class

WebformCompositeBase
Provides a base for composite elements.

Namespace

Drupal\webform\Plugin\WebformElement

Code

public function getManagedFiles(array $element) {
  $id = $element['#webform_id'];
  if (isset($this->elementsManagedFiles[$id])) {
    return $this->elementsManagedFiles[$id];
  }
  $this->elementsManagedFiles[$id] = [];
  $composite_elements = WebformElementHelper::getFlattened($this
    ->getInitializedCompositeElement($element));
  foreach ($composite_elements as $composite_key => $composite_element) {
    $composite_element_plugin = $this->elementManager
      ->getElementInstance($composite_element);
    if ($composite_element_plugin instanceof WebformManagedFileBase) {
      $this->elementsManagedFiles[$id][$composite_key] = $composite_key;
    }
  }
  return $this->elementsManagedFiles[$id];
}