Created
December 6, 2020 08:44
-
-
Save klaasvw/588252082bd2a2f79fa5bff23e80617e to your computer and use it in GitHub Desktop.
Remove or strip the scheme from a file stream wrapper in Drupal 9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$uri = 'public://path/to/file.txt'; | |
/** @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface $stream_wrapper_manager */ | |
$stream_wrapper_manager = \Drupal::service('stream_wrapper_manager'); | |
$target = $stream_wrapper_manager->getTarget($uri); | |
// $target = 'path/to/file.txt'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment