You are here

public static function WebformEntityPrintAttachment::getFileName in Webform 6.x

Same name and namespace in other branches
  1. 8.5 modules/webform_entity_print_attachment/src/Element/WebformEntityPrintAttachment.php \Drupal\webform_entity_print_attachment\Element\WebformEntityPrintAttachment::getFileName()

Get a webform attachment's file name.

Parameters

array $element: The webform attachment element.

\Drupal\webform\WebformSubmissionInterface $webform_submission: A webform submission.

Return value

mixed|string The attachment's file name.

Overrides WebformAttachmentBase::getFileName

File

modules/webform_entity_print_attachment/src/Element/WebformEntityPrintAttachment.php, line 76

Class

WebformEntityPrintAttachment
Provides a 'webform_entity_print_attachment' element.

Namespace

Drupal\webform_entity_print_attachment\Element

Code

public static function getFileName(array $element, WebformSubmissionInterface $webform_submission) {
  if (empty($element['#filename'])) {
    return $element['#webform_key'] . '.' . static::getExportTypeFileExtension($element);
  }
  else {
    return parent::getFileName($element, $webform_submission);
  }
}