diff --git a/src/Contao/View/Contao2BackendView/EditMask.php b/src/Contao/View/Contao2BackendView/EditMask.php index 64cadd2e..f409436c 100644 --- a/src/Contao/View/Contao2BackendView/EditMask.php +++ b/src/Contao/View/Contao2BackendView/EditMask.php @@ -1021,17 +1021,10 @@ public function execute() private function executeMultiLanguage(ContaoBackendViewTemplate $template) { $dataProvider = $this->getEnvironment()->getDataProvider($this->model->getProviderName()); - assert($dataProvider instanceof DataProviderInterface); - if ( - \in_array( - MultiLanguageDataProviderInterface::class, - \class_implements($dataProvider) - ) + $dataProvider instanceof MultiLanguageDataProviderInterface + && null !== $dataProvider->getLanguages($this->model->getId()) ) { - /** @var MultiLanguageDataProviderInterface $dataProvider */ - $dataProvider = $this->getEnvironment()->getDataProvider(); - $locales = System::getContainer()->get('contao.intl.locales'); assert($locales instanceof Locales); @@ -1043,10 +1036,8 @@ private function executeMultiLanguage(ContaoBackendViewTemplate $template) $translator = $this->environment->getTranslator(); assert($translator instanceof TranslatorInterface); - $template->set( - 'languages', - $controller->getSupportedLanguages($this->model->getId()) - ) + $template + ->set('languages', $controller->getSupportedLanguages($this->model->getId())) ->set('language', $dataProvider->getCurrentLanguage()) ->set('languageSubmit', $translator->translate('MSC.showSelected')) ->set('languageHeadline', $languages[$dataProvider->getCurrentLanguage()] ?? ''); diff --git a/src/DataContainerInterface.php b/src/DataContainerInterface.php index ea9fec8d..2b7c84c0 100644 --- a/src/DataContainerInterface.php +++ b/src/DataContainerInterface.php @@ -21,9 +21,15 @@ namespace ContaoCommunityAlliance\DcGeneral; +use Contao\EditableDataContainerInterface; +use Contao\ListableDataContainerInterface; + /** * This interface describes an object providing access to an environment. */ -interface DataContainerInterface extends \editable, \listable, EnvironmentAwareInterface +interface DataContainerInterface extends + EditableDataContainerInterface, + ListableDataContainerInterface, + EnvironmentAwareInterface { }