Skip to content
Snippets Groups Projects
Commit b9e7be56 authored by mcgettrs's avatar mcgettrs Committed by Matthew Grasmick
Browse files

Issue #3182487 by mcgettrs: Form fails on drupal 9 because of non-existing method

parent 650b81d1
No related branches found
No related tags found
No related merge requests found
.idea
*.patch
*.diff
*.rej
*.orig
vendor
......@@ -134,7 +134,7 @@ class AchievementEntityForm extends EntityForm {
// directory; stream wrappers are not end-user friendly.
$original_path = $element['#default_value'];
$friendly_path = NULL;
if (\Drupal::service('file_system')->uriScheme($original_path) == 'public') {
if (\Drupal::service('stream_wrapper_manager')->getScheme($original_path) == 'public') {
$friendly_path = \Drupal::service('stream_wrapper_manager')->getTarget($original_path);
$element['#default_value'] = $friendly_path;
}
......@@ -149,7 +149,7 @@ class AchievementEntityForm extends EntityForm {
$element['#description'] = $this->t('Examples: <code>@implicit-public-file</code> (for a file in the public filesystem), <code>@explicit-file</code>, or <code>@local-file</code>.', [
'@implicit-public-file' => isset($friendly_path) ? $friendly_path : $default,
'@explicit-file' => \Drupal::service('file_system')->uriScheme($original_path) !== FALSE ? $original_path : 'public://' . $default,
'@explicit-file' => \Drupal::service('stream_wrapper_manager')->getScheme($original_path) !== FALSE ? $original_path : 'public://' . $default,
'@local-file' => $local_file,
]);
}
......@@ -216,7 +216,7 @@ class AchievementEntityForm extends EntityForm {
return $path;
}
// Prepend 'public://' for relative file paths within public filesystem.
if (\Drupal::service('file_system')->uriScheme($path) === FALSE) {
if (\Drupal::service('stream_wrapper_manager')->getScheme($path) === FALSE) {
$path = 'public://' . $path;
}
if (is_file($path)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment