You are here

protected function WebformSubmissionExporter::getWebformExportAttachmentElements in Webform 6.x

Get attachment elements with files that can be exported.

Return value

array An associative array of attachment elements with files that can be exported.

3 calls to WebformSubmissionExporter::getWebformExportAttachmentElements()
WebformSubmissionExporter::getBatchLimit in src/WebformSubmissionExporter.php
Get the number of submissions to be exported with each batch.
WebformSubmissionExporter::hasWebformExportAttachmentElements in src/WebformSubmissionExporter.php
Determin if the webform c elements with files that can be exported.
WebformSubmissionExporter::writeRecords in src/WebformSubmissionExporter.php
Write webform results header to export file.

File

src/WebformSubmissionExporter.php, line 1038

Class

WebformSubmissionExporter
Webform submission exporter.

Namespace

Drupal\webform

Code

protected function getWebformExportAttachmentElements() {
  if (isset($this->attachmentElements)) {
    return $this->attachmentElements;
  }
  $attachment_elements = $this
    ->getWebform()
    ->getElementsAttachments();
  $this->attachmentElements = [];
  foreach ($attachment_elements as $attachment_element_key) {
    $attachment_element = $this
      ->getWebform()
      ->getElement($attachment_element_key);

    /** @var \Drupal\webform\Plugin\WebformElementAttachmentInterface $attachment_element_plugin */
    $attachment_element_plugin = $this->elementManager
      ->getElementInstance($attachment_element);
    if ($attachment_element_plugin
      ->hasExportAttachments()) {
      $this->attachmentElements[$attachment_element_key] = $attachment_element;
    }
  }
  return $this->attachmentElements;
}