public static function WebformAttachmentBase::getFileLink in Webform 8.5
Same name and namespace in other branches
- 6.x modules/webform_attachment/src/Element/WebformAttachmentBase.php \Drupal\webform_attachment\Element\WebformAttachmentBase::getFileLink()
Get a webform attachment's file link.
Parameters
array $element: The webform attachment element.
\Drupal\webform\WebformSubmissionInterface $webform_submission: A webform submission.
Return value
array A renderable array containing a link to the webform attachment's URL.
Overrides WebformAttachmentInterface::getFileLink
1 call to WebformAttachmentBase::getFileLink()
- WebformAttachmentBase::processWebformAttachment in modules/
webform_attachment/ src/ Element/ WebformAttachmentBase.php - Processes a 'webform_attachment' element.
File
- modules/
webform_attachment/ src/ Element/ WebformAttachmentBase.php, line 143
Class
- WebformAttachmentBase
- Provides a base class for 'webform_attachment' elements.
Namespace
Drupal\webform_attachment\ElementCode
public static function getFileLink(array $element, WebformSubmissionInterface $webform_submission) {
$title = !empty($element['#link_title']) ? $element['#link_title'] : static::getFileName($element, $webform_submission);
$url = static::getFileUrl($element, $webform_submission);
return [
'#type' => 'link',
'#title' => $title,
'#url' => $url,
];
}