|
|
|
@ -2,6 +2,7 @@
|
|
|
|
|
|
|
|
|
|
namespace Drupal\islandora\Flysystem; |
|
|
|
|
|
|
|
|
|
use Drupal\Core\Language\LanguageManagerInterface; |
|
|
|
|
use Drupal\Core\Logger\RfcLogLevel; |
|
|
|
|
use Drupal\Core\Plugin\ContainerFactoryPluginInterface; |
|
|
|
|
use Drupal\Core\Url; |
|
|
|
@ -30,6 +31,13 @@ class Fedora implements FlysystemPluginInterface, ContainerFactoryPluginInterfac
|
|
|
|
|
|
|
|
|
|
protected $mimeTypeGuesser; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Language manager. |
|
|
|
|
* |
|
|
|
|
* @var \Drupal\Core\Language\LanguageManagerInterface |
|
|
|
|
*/ |
|
|
|
|
protected $languageManager; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Constructs a Fedora plugin for Flysystem. |
|
|
|
|
* |
|
|
|
@ -37,13 +45,17 @@ class Fedora implements FlysystemPluginInterface, ContainerFactoryPluginInterfac
|
|
|
|
|
* Fedora client. |
|
|
|
|
* @param \Symfony\Component\HttpFoundation\File\Mimetype\MimeTypeGuesserInterface $mime_type_guesser |
|
|
|
|
* Mimetype guesser. |
|
|
|
|
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager |
|
|
|
|
* Language manager. |
|
|
|
|
*/ |
|
|
|
|
public function __construct( |
|
|
|
|
IFedoraApi $fedora, |
|
|
|
|
MimeTypeGuesserInterface $mime_type_guesser |
|
|
|
|
MimeTypeGuesserInterface $mime_type_guesser, |
|
|
|
|
LanguageManagerInterface $language_manager |
|
|
|
|
) { |
|
|
|
|
$this->fedora = $fedora; |
|
|
|
|
$this->mimeTypeGuesser = $mime_type_guesser; |
|
|
|
|
$this->languageManager = $language_manager; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -63,7 +75,8 @@ class Fedora implements FlysystemPluginInterface, ContainerFactoryPluginInterfac
|
|
|
|
|
// Return it. |
|
|
|
|
return new static( |
|
|
|
|
$fedora, |
|
|
|
|
$container->get('file.mime_type.guesser') |
|
|
|
|
$container->get('file.mime_type.guesser'), |
|
|
|
|
$container->get('language_manager') |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -129,7 +142,7 @@ class Fedora implements FlysystemPluginInterface, ContainerFactoryPluginInterfac
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
// Force file urls to be language neutral. |
|
|
|
|
$undefined = \Drupal::languageManager()->getLanguage('und'); |
|
|
|
|
$undefined = $this->languageManager->getLanguage('und'); |
|
|
|
|
return Url::fromRoute( |
|
|
|
|
'flysystem.serve', |
|
|
|
|
$arguments, |
|
|
|
|