Commit 0e161d98 authored by Stefan Galinski's avatar Stefan Galinski 🎮
Browse files

[BUGFIX] Fix implementation

parent f00bc512
<?php
namespace TYPO3\Languagevisibility\Hook;
/***************************************************************
* Copyright notice
*
......@@ -25,19 +23,18 @@ namespace TYPO3\Languagevisibility\Hook;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
namespace TYPO3\Languagevisibility\Hook;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver\Exception;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\QueryBuilder;
use TYPO3\CMS\Core\Exception\SiteNotFoundException;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Page\PageRenderer;
use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
use TYPO3\CMS\Core\Site\SiteFinder;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
use TYPO3\Languagevisibility\Element\Element;
use TYPO3\Languagevisibility\Element\ElementFactory;
......@@ -99,7 +96,7 @@ class PageLayoutViewHook {
try {
$isElementVisible = $this->frontendServices::checkVisiblityForElement($row, $tableName, $sysLanguageUid);
} catch (\Doctrine\DBAL\Driver\Exception|\Exception $e) {
} catch (Exception|\Exception $e) {
$isElementVisible = FALSE;
}
......@@ -129,7 +126,7 @@ class PageLayoutViewHook {
if ($isElementVisible && $isL10nParentHidden) {
$isElementVisible = FALSE;
}
} catch (DBALException|Exception) {
} catch (DBALException|Exception $e) {
}
}
......@@ -213,7 +210,7 @@ class PageLayoutViewHook {
try {
// This element is an original element (no overlay)
$originalElement = $elementfactory->getElementForTable($table, $row);
} catch (TableNotSupportedException) {
} catch (TableNotSupportedException $e) {
return '<div class="alert alert-danger">' .
$this->getLLL('backend.error.elementNotSupported') . '</div>';
}
......@@ -311,7 +308,7 @@ class PageLayoutViewHook {
$uid,
$languageId
);
} catch (DBALException|Exception) {
} catch (DBALException|Exception $e) {
$visbilityFlag = NULL;
}
......
<?php
declare(strict_types=1);
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use TYPO3\Languagevisibility\Element\ContentElement;
use TYPO3\Languagevisibility\Element\Element;
use TYPO3\Languagevisibility\Element\RecordElement;
use TYPO3\Languagevisibility\Xclass\Gridelements\Gridelements;
/***************************************************************
* Copyright notice
*
......@@ -30,7 +23,15 @@ use TYPO3\Languagevisibility\Xclass\Gridelements\Gridelements;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\Languagevisibility\Hook\PageLayoutController;
use TYPO3\Languagevisibility\Service\FrontendServices;
use TYPO3\Languagevisibility\Xclass\Mask\InlineHelper;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use TYPO3\Languagevisibility\Element\ContentElement;
use TYPO3\Languagevisibility\Element\Element;
use TYPO3\Languagevisibility\Element\RecordElement;
use TYPO3\Languagevisibility\Xclass\Gridelements\Gridelements;
use TYPO3\Languagevisibility\Hook\PageLayoutViewHook;
// Define the required dependencies excl. gridelements/mask if not installed
return static function (ContainerConfigurator $containerConfigurator): void {
......@@ -50,11 +51,11 @@ return static function (ContainerConfigurator $containerConfigurator): void {
$services->set(RecordElement::class)->autowire(FALSE)->autoconfigure(FALSE);
$services->get(PageLayoutViewHook::class)->public()->args(
[new Reference(FrontendServices::class)]
[new Symfony\Component\DependencyInjection\Reference(FrontendServices::class)]
);
$services->get(PageLayoutController::class)->public()->args(
[new Reference(FrontendServices::class)]
[new Symfony\Component\DependencyInjection\Reference(FrontendServices::class)]
);
// removed ExtensionManagementUtility::isLoaded() calls, because these fail randomly,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment