protected function WebformElementFormatTest::getSubmissionFileUrl in Webform 8.5
Same name and namespace in other branches
- 6.x tests/src/Functional/Element/WebformElementFormatTest.php \Drupal\Tests\webform\Functional\Element\WebformElementFormatTest::getSubmissionFileUrl()
Get submission element's file URL.
Parameters
\Drupal\webform\WebformSubmissionInterface $submission: A webform submission.
string $element_key: The element key.
Return value
string A submission element's file URL.
1 call to WebformElementFormatTest::getSubmissionFileUrl()
- WebformElementFormatTest::testFormat in tests/
src/ Functional/ Element/ WebformElementFormatTest.php - Tests element format.
File
- tests/
src/ Functional/ Element/ WebformElementFormatTest.php, line 315
Class
- WebformElementFormatTest
- Tests for webform submission webform element custom #format support.
Namespace
Drupal\Tests\webform\Functional\ElementCode
protected function getSubmissionFileUrl(WebformSubmissionInterface $submission, $element_key) {
$fid = $submission
->getElementData($element_key);
$file = File::load($fid);
return file_create_url($file
->getFileUri());
}