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