protected function YamlFormManagedFileBase::getUploadLocation in YAML Form 8
Get file upload location.
Parameters
array $element: An element.
\Drupal\yamlform\YamlFormInterface $yamlform: A form.
Return value
string Upload location.
2 calls to YamlFormManagedFileBase::getUploadLocation()
- YamlFormManagedFileBase::getTestValue in src/
Plugin/ YamlFormElement/ YamlFormManagedFileBase.php - Get test value for an element.
- YamlFormManagedFileBase::prepare in src/
Plugin/ YamlFormElement/ YamlFormManagedFileBase.php - Prepare an element to be rendered within a form.
File
- src/
Plugin/ YamlFormElement/ YamlFormManagedFileBase.php, line 463
Class
- YamlFormManagedFileBase
- Provides a base class form 'managed_file' elements.
Namespace
Drupal\yamlform\Plugin\YamlFormElementCode
protected function getUploadLocation(array $element, YamlFormInterface $yamlform) {
if (empty($element['#upload_location'])) {
$upload_location = $this
->getUriScheme($element) . '://yamlform/' . $yamlform
->id() . '/_sid_';
}
else {
$upload_location = $element['#upload_location'];
}
// Make sure the upload location exists and is writable.
file_prepare_directory($upload_location, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
return $upload_location;
}