From b3af3e17335fa87776fd0f1bd20a8dd6a05471f5 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Mon, 17 Sep 2018 09:03:58 +0200 Subject: [PATCH 01/93] [FEATURE] first steps for redesign --- .../Backend/Partials/General/Controls.html | 17 +---- .../Backend/Templates/WizardContent/Edit.html | 6 +- .../Backend/Templates/WizardContent/New.html | 4 +- .../Backend/Templates/WizardPage/Edit.html | 4 +- Resources/Public/Styles/styles.css | 72 +++++++++++++++++-- 5 files changed, 73 insertions(+), 30 deletions(-) diff --git a/Resources/Private/Backend/Partials/General/Controls.html b/Resources/Private/Backend/Partials/General/Controls.html index 9c73a802..debaf7a1 100644 --- a/Resources/Private/Backend/Partials/General/Controls.html +++ b/Resources/Private/Backend/Partials/General/Controls.html @@ -1,19 +1,4 @@ - - - + class="btn btn-success col-sm-12" /> diff --git a/Resources/Private/Backend/Templates/WizardContent/Edit.html b/Resources/Private/Backend/Templates/WizardContent/Edit.html index 3d6b7585..c57c7a7c 100644 --- a/Resources/Private/Backend/Templates/WizardContent/Edit.html +++ b/Resources/Private/Backend/Templates/WizardContent/Edit.html @@ -8,12 +8,12 @@
-

{storage.label}

+

{storage.label} {storage.key}

-
+
@@ -21,7 +21,7 @@

{storage.label}

-
+
  • -
    +
    @@ -24,7 +24,7 @@

    -
    +
      diff --git a/Resources/Private/Backend/Templates/WizardPage/Edit.html b/Resources/Private/Backend/Templates/WizardPage/Edit.html index 971ccbe3..45e0ee71 100644 --- a/Resources/Private/Backend/Templates/WizardPage/Edit.html +++ b/Resources/Private/Backend/Templates/WizardPage/Edit.html @@ -15,7 +15,7 @@

      -
      +
      @@ -24,7 +24,7 @@

      -
      +
      • Date: Mon, 17 Sep 2018 23:36:42 +0200 Subject: [PATCH 02/93] [FEATURE] redesign of mask list view --- .../Controller/WizardContentController.php | 10 +- Classes/Controller/WizardController.php | 25 +- Classes/Controller/WizardPageController.php | 12 - .../Backend/Templates/Wizard/List.html | 224 ++++++++++++++++++ .../Backend/Templates/WizardContent/List.html | 16 +- Resources/Private/Language/de.locallang.xlf | 10 +- Resources/Private/Language/locallang.xlf | 6 +- Resources/Public/Styles/styles.css | 29 +++ ext_tables.php | 5 +- 9 files changed, 299 insertions(+), 38 deletions(-) create mode 100644 Resources/Private/Backend/Templates/Wizard/List.html diff --git a/Classes/Controller/WizardContentController.php b/Classes/Controller/WizardContentController.php index dac9f30d..62c3e328 100755 --- a/Classes/Controller/WizardContentController.php +++ b/Classes/Controller/WizardContentController.php @@ -147,7 +147,7 @@ public function deleteAction($key, $type) $this->generateAction(); $this->addFlashMessage(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_mask.content.deletedcontentelement', 'mask')); - $this->redirect('list'); + $this->redirect('list', 'Wizard'); } /** @@ -164,7 +164,7 @@ public function purgeAction($key, $type) $this->generateAction(); $this->addFlashMessage(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_mask.content.deletedcontentelement', 'mask')); - $this->redirect('list'); + $this->redirect('list', 'Wizard'); } /** @@ -179,7 +179,7 @@ public function hideAction($key) $this->generateAction(); $this->addFlashMessage(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_mask.content.hiddencontentelement', 'mask')); - $this->redirect('list'); + $this->redirect('list','Wizard'); } /** @@ -194,7 +194,7 @@ public function activateAction($key) $this->generateAction(); $this->addFlashMessage(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_mask.content.activatedcontentelement', 'mask')); - $this->redirect('list'); + $this->redirect('list','Wizard'); } /** @@ -224,7 +224,7 @@ protected function createHtmlAction($key) { $html = $this->htmlCodeGenerator->generateHtml($key, 'tt_content'); $this->saveHtml($key, $html); - $this->redirect('list'); + $this->redirect('list', 'Wizard'); } } diff --git a/Classes/Controller/WizardController.php b/Classes/Controller/WizardController.php index dec296eb..e7e44ae5 100755 --- a/Classes/Controller/WizardController.php +++ b/Classes/Controller/WizardController.php @@ -241,7 +241,7 @@ protected function redirectByAction() $this->redirect('edit', null, null, $arguments); } else { if (key_exists("saveAndExit", $formAction)) { - $this->redirect('list'); + $this->redirect('list', 'Wizard'); } } } @@ -254,9 +254,7 @@ protected function redirectByAction() */ protected function checkFolders() { - $messages = []; - if (!file_exists(PATH_site . $this->extSettings["content"])) { $messages[] = $this->extSettings["content"] . ": " . \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_mask.all.error.missingfolder', 'mask'); @@ -297,4 +295,25 @@ public function createMissingFoldersAction() } $this->redirect("list"); } + + + /** + * action list + * + * @return void + */ + public function listAction() + { + $settings = $this->settingsService->get(); + $storages = $this->storageRepository->load(); + $backendLayouts = $this->backendLayoutRepository->findAll(explode(",", $settings['backendlayout_pids'])); + $messages = $this->checkFolders(); + $missingFolders = count($messages) > 0; + + $this->view->assign('messages', $messages); + $this->view->assign('missingFolders', $missingFolders); + $this->view->assign('storages', $storages); + $this->view->assign('backendLayouts', $backendLayouts); + + } } diff --git a/Classes/Controller/WizardPageController.php b/Classes/Controller/WizardPageController.php index bc2605cc..f539b255 100755 --- a/Classes/Controller/WizardPageController.php +++ b/Classes/Controller/WizardPageController.php @@ -44,18 +44,6 @@ class WizardPageController extends \MASK\Mask\Controller\WizardController */ protected $storageRepository; - /** - * action list - * - * @return void - */ - public function listAction() - { - $settings = $this->settingsService->get(); - $backendLayouts = $this->backendLayoutRepository->findAll(explode(",", $settings['backendlayout_pids'])); - $this->view->assign('backendLayouts', $backendLayouts); - } - /** * action new * diff --git a/Resources/Private/Backend/Templates/Wizard/List.html b/Resources/Private/Backend/Templates/Wizard/List.html new file mode 100644 index 00000000..0e97f134 --- /dev/null +++ b/Resources/Private/Backend/Templates/Wizard/List.html @@ -0,0 +1,224 @@ +{namespace mask=MASK\Mask\ViewHelpers} +{namespace core = TYPO3\CMS\Core\ViewHelpers} + + +

        + + Mask + + + +

        + + + + + + + {message}
        +
        +
        + + + +
        + + +
        + +
        +
        +

        + + + erstellen +

        +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        + + + + + + + + + +  
        + + + + +

        + + {storage.label} + +
        {key} +

        +
        +

        {storage.description}

        + + + + + + +
        + + +
        + + + + + + + + + + + + + + + + + + + + + +
        +
        + + + Neues Inhaltselement anlegen + +
        +
        + +
        +

        + + + erweitern +

        + + + + + + + +
        + + + + + + + + + + + + + + + + + + + +
        + + + + + +  
        + + + + + + + + + + + + + + +

        + +
        {layout.identifier} +

        +
        +

        {layout.description}

        +
        + + + + + + +
        +
        +
        +
        +
        +
        + developed by
        + + + +
        +
        +
        + +
        +
        + + +
        diff --git a/Resources/Private/Backend/Templates/WizardContent/List.html b/Resources/Private/Backend/Templates/WizardContent/List.html index eb601fa8..810c7756 100644 --- a/Resources/Private/Backend/Templates/WizardContent/List.html +++ b/Resources/Private/Backend/Templates/WizardContent/List.html @@ -57,13 +57,13 @@ - +

        - + {storage.label}
        {key} @@ -74,7 +74,7 @@

        {storage.description}

        - + @@ -84,27 +84,27 @@
        - - + - + - + - +
        diff --git a/Resources/Private/Language/de.locallang.xlf b/Resources/Private/Language/de.locallang.xlf index fa20866e..9e03bc9d 100644 --- a/Resources/Private/Language/de.locallang.xlf +++ b/Resources/Private/Language/de.locallang.xlf @@ -455,13 +455,13 @@ Titel - Fehler! + Fehlende Verzeichnisse! Bild - Titel/Key + Titel / Key Beschreibung @@ -540,7 +540,7 @@ Bild - Titel/Uid + Titel / Uid Beschreibung @@ -554,7 +554,7 @@ - Achtung! + Kein Backendlayout gefunden Backend-Layout wurde aktualisert. @@ -586,7 +586,7 @@ Inhaltselemente - Seitenvorlagen + Backendlayouts diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf index 53891e24..ad77977b 100644 --- a/Resources/Private/Language/locallang.xlf +++ b/Resources/Private/Language/locallang.xlf @@ -451,7 +451,7 @@ Title - Error! + Missing folders! Image @@ -542,10 +542,10 @@ Extend Backend-Layout - No Backend-Layout found. Create at least one Backend-Layout in module "List". + Create at least one Backendlayout in module "List". - Caution! + No Backendlayout found Backend-Layout was updated. diff --git a/Resources/Public/Styles/styles.css b/Resources/Public/Styles/styles.css index 84d6f3c4..f903d4d9 100644 --- a/Resources/Public/Styles/styles.css +++ b/Resources/Public/Styles/styles.css @@ -702,3 +702,32 @@ UL.tx_mask_fieldtypes .tx_mask_fieldcontent_highlight { content: "\f077" !important; font-family: FontAwesome !important; } + +thead th { + height: 42px; +} + +table .btn-add { + margin: 8px auto; + display: block; + width: 270px; +} + +h1 .icon.t3js-icon { + margin-right: 10px; +} + +.imprint { + text-align: right; + margin-top: 70px; + letter-spacing: 2px; + font-size: 11px; + font-family: 'Source Sans Pro', sans-serif; + line-height: 11px; + color: #797979; + filter: saturate(0); +} + +img.brand-logo { + width: 100px; +} diff --git a/ext_tables.php b/ext_tables.php index abbe0454..e9d982ed 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -13,8 +13,9 @@ 'mask', // Submodule key 'top', // Position array( - 'WizardContent' => 'list, new, create, edit, update, delete, purge, generate, showHtml, createMissingFolders, hide, activate, createHtml', - 'WizardPage' => 'list, new, create, edit, update, delete, showHtml', + 'Wizard' => 'list', + 'WizardContent' => 'new, create, edit, update, delete, purge, generate, showHtml, createMissingFolders, hide, activate, createHtml', + 'WizardPage' => 'new, create, edit, update, delete, showHtml', ), array( 'access' => 'admin', 'icon' => 'EXT:' . $_EXTKEY . '/Resources/Public/Icons/module-mask_wizard.svg', From 57a5bd364d7798dc2bc8fadd22e8e3c6fc2b3253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20DANIEL?= Date: Fri, 6 Sep 2019 18:45:33 +0200 Subject: [PATCH 03/93] [BUGFIX] Fix TCA default value of field parentid for Inline-Tables A default value is required by the DataHandler in order to guess the right field type, and to send the right value to the database. A wrong type can lead to SQL errors if the SQL server with strict_mode enabled. --- Classes/CodeGenerator/TcaCodeGenerator.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Classes/CodeGenerator/TcaCodeGenerator.php b/Classes/CodeGenerator/TcaCodeGenerator.php index b8da61b1..33d583d3 100644 --- a/Classes/CodeGenerator/TcaCodeGenerator.php +++ b/Classes/CodeGenerator/TcaCodeGenerator.php @@ -453,6 +453,7 @@ public function generateTableTca($table, $tca) 'foreign_table_where' => 'AND tt_content.pid=###CURRENT_PID### AND tt_content.sys_language_uid IN (-1,###REC_FIELD_sys_language_uid###)', + 'default' => 0 ), ), 'parenttable' => array( From 44764b58dcc25e4d1d7f4e065432244f401124d3 Mon Sep 17 00:00:00 2001 From: Wolfgang Klinger Date: Thu, 12 Dec 2019 11:17:54 +0100 Subject: [PATCH 04/93] [BUGFIX] Replace user_mask_contentType with symfony expression language function Fixes #253 --- .../CodeGenerator/TyposcriptCodeGenerator.php | 2 +- ...kContentTypeConditionFunctionsProvider.php | 92 +++++++++++++++++++ .../MaskContentTypeConditionProvider.php | 25 +++++ Configuration/ExpressionLanguage.php | 10 ++ ext_localconf.php | 48 ---------- 5 files changed, 128 insertions(+), 49 deletions(-) create mode 100644 Classes/ExpressionLanguage/MaskContentTypeConditionFunctionsProvider.php create mode 100644 Classes/ExpressionLanguage/MaskContentTypeConditionProvider.php create mode 100644 Configuration/ExpressionLanguage.php diff --git a/Classes/CodeGenerator/TyposcriptCodeGenerator.php b/Classes/CodeGenerator/TyposcriptCodeGenerator.php index c80240a8..4f2486b0 100644 --- a/Classes/CodeGenerator/TyposcriptCodeGenerator.php +++ b/Classes/CodeGenerator/TyposcriptCodeGenerator.php @@ -83,7 +83,7 @@ public function generateTsConfig($json) $content .= "}\n"; // and switch the labels depending on which content element is selected - $content .= "\n[userFunc = user_mask_contentType(CType|mask_" . $element["key"] . ")]\n"; + $content .= "\n[isMaskContentType('" . $element['key'] . "')]\n"; if ($element["columns"]) { foreach ($element["columns"] as $index => $column) { $content .= " TCEFORM.tt_content." . $column . ".label = " . $element["labels"][$index] . "\n"; diff --git a/Classes/ExpressionLanguage/MaskContentTypeConditionFunctionsProvider.php b/Classes/ExpressionLanguage/MaskContentTypeConditionFunctionsProvider.php new file mode 100644 index 00000000..9c098421 --- /dev/null +++ b/Classes/ExpressionLanguage/MaskContentTypeConditionFunctionsProvider.php @@ -0,0 +1,92 @@ + + */ +class MaskContentTypeConditionFunctionsProvider implements ExpressionFunctionProviderInterface +{ + /** + * @return ExpressionFunction[] + */ + public function getFunctions(): array + { + return [ + $this->getMaskContentElementFunction() + ]; + } + + /** + * @return ExpressionFunction + */ + protected function getMaskContentElementFunction(): ExpressionFunction + { + $getContentElementType = static function (int $uid): string { + /** @var QueryBuilder $queryBuilder */ + $queryBuilder = GeneralUtility::makeInstance(ConnectionPoolAlias::class) + ->getQueryBuilderForTable('tt_content'); + /** @var DeletedRestriction $deletedRestriction */ + $deletedRestriction = GeneralUtility::makeInstance(DeletedRestrictionAlias::class); + $queryBuilder->getRestrictions() + ->removeAll() + ->add($deletedRestriction); + + return (string)$queryBuilder->select('CType') + ->from('tt_content') + ->where($queryBuilder->expr()->eq('uid', $uid)) + ->execute() + ->fetchColumn(); + }; + + return new ExpressionFunction('isMaskContentType', static function () { + // Not implemented, we only use the evaluator + }, static function ($arguments, $value) use ($getContentElementType) { + static $contentTypeMappingCache = []; + + /** @var RequestWrapper $request */ + $request = $arguments['request']; + $requestParameters = $request->getQueryParams(); + if (isset($requestParameters['edit']['tt_content']) && + is_array($requestParameters['edit']['tt_content']) + ) { + $formType = (string)current($requestParameters['edit']['tt_content']); + $contentType = null; + // New record, content type (CType) given as request parameter + if ($formType === 'new' && isset($requestParameters['defVals']['tt_content']['CType'])) { + $contentType = (string)$requestParameters['defVals']['tt_content']['CType']; + } else { + // Existing record, fetch content type (CType) from database + $uid = (int)key($requestParameters['edit']['tt_content']); + $contentType = $contentTypeMappingCache[$uid] ?? $getContentElementType($uid); + } + + return $contentType === 'mask_' . $value; + } + + // Content element is loaded via ajax (inline) + $parsedBody = $request->getParsedBody(); + if (isset($parsedBody['ajax']['context'])) { + $parsedContext = json_decode($parsedBody['ajax']['context'], true); + if (isset($parsedContext['config']['overrideChildTca']['columns']['CType']['config']['default'])) { + return $parsedContext['config']['overrideChildTca']['columns']['CType']['config']['default'] === 'mask_' . $value; + } + } + + return false; + }); + } +} diff --git a/Classes/ExpressionLanguage/MaskContentTypeConditionProvider.php b/Classes/ExpressionLanguage/MaskContentTypeConditionProvider.php new file mode 100644 index 00000000..0022aaa7 --- /dev/null +++ b/Classes/ExpressionLanguage/MaskContentTypeConditionProvider.php @@ -0,0 +1,25 @@ + + */ +class MaskContentTypeConditionProvider extends AbstractProvider +{ + public function __construct() + { + $this->expressionLanguageVariables = [ + 'request' => GeneralUtility::makeInstance(RequestWrapper::class, $GLOBALS['TYPO3_REQUEST'] ?? null), + ]; + $this->expressionLanguageProviders[] = MaskContentTypeConditionFunctionsProvider::class; + } +} diff --git a/Configuration/ExpressionLanguage.php b/Configuration/ExpressionLanguage.php new file mode 100644 index 00000000..932672bb --- /dev/null +++ b/Configuration/ExpressionLanguage.php @@ -0,0 +1,10 @@ + [ + \MASK\Mask\ExpressionLanguage\MaskContentTypeConditionProvider::class, + ] +]; diff --git a/ext_localconf.php b/ext_localconf.php index 6510c60a..17100635 100755 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -49,54 +49,6 @@ $setupTs = $typoScriptCodeGenerator->generateSetupTyposcript($configuration, $settings); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptSetup($setupTs); -// for conditions on tt_content -if (!function_exists('user_mask_contentType')) { - - function user_mask_contentType($param = "") - { - static $cTypeCache = []; - - if (isset($_REQUEST["edit"]["tt_content"]) && is_array($_REQUEST["edit"]["tt_content"])) { - $field = explode("|", $param); - $request = $_REQUEST; - $first = array_shift($request["edit"]["tt_content"]); - - if ($first == "new") { // if new element - if ($_REQUEST["defVals"]["tt_content"]["CType"] == $field[1]) { - return true; - } else { - return false; - } - } else { // if element exists - $uid = intval(key($_REQUEST["edit"]["tt_content"])); - - if (!isset($cTypeCache[$uid])) { - /** @var \TYPO3\CMS\Core\Database\ConnectionPool $connection */ - $connection = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\ConnectionPool::class); - $queryBuilder = $connection->getQueryBuilderForTable('tt_content'); - /** @var \TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction $deletedRestriction */ - $deletedRestriction = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction::class); - $queryBuilder->getRestrictions()->removeAll()->add($deletedRestriction); - $cTypeCache[$uid] = $queryBuilder->select($field[0]) - ->from('tt_content') - ->where($queryBuilder->expr()->eq('uid', $uid)) - ->execute() - ->fetchColumn(0); - } - - return $cTypeCache[$uid] == $field[1]; - } - } else { - // if content element is loaded by ajax, then it's ok - if (is_array($_REQUEST["ajax"])) { - return true; - } else { - return false; - } - } - } -} - // for conditions on the backend-layouts if (!function_exists('user_mask_beLayout')) { From abe8532173763bb6da9a704e645afeb3e9d31425 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Venne?= Date: Fri, 10 Jan 2020 11:22:45 +0100 Subject: [PATCH 05/93] [TASK] Set TYPO3 version to 10.3.0-dev --- composer.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 94aa22ee..93fcfac4 100644 --- a/composer.json +++ b/composer.json @@ -26,10 +26,10 @@ "require": { "php": "^7.2", "ext-json": "*", - "typo3/cms-core": "^9.5", - "typo3/cms-backend": "^9.5", - "typo3/cms-fluid": "^9.5", - "typo3/cms-extbase": "^9.5" + "typo3/cms-core": "10.3.*@dev", + "typo3/cms-backend": "10.3.*@dev", + "typo3/cms-fluid": "10.3.*@dev", + "typo3/cms-extbase": "10.3.*@dev" }, "replace": { "mask": "self.version", From 452a17f57ab975ad8786393fab60bb63ab35f03c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Venne?= Date: Fri, 10 Jan 2020 16:06:39 +0100 Subject: [PATCH 06/93] [TASK] remove $_EXTKEY --- ext_localconf.php | 295 +++++++++++++++++++++------------------------- ext_tables.php | 81 +++++++------ 2 files changed, 177 insertions(+), 199 deletions(-) diff --git a/ext_localconf.php b/ext_localconf.php index 6510c60a..3bc01a71 100755 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -1,74 +1,69 @@ load(); -$settings = $settingsService->get(); - -// Register Icons needed in the backend module -$iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance("TYPO3\CMS\Core\Imaging\IconRegistry"); -$maskIcons = array( - "Check", - "Date", - "Datetime", - "File", - "Float", - "Inline", - "Integer", - "Link", - "Radio", - "Richtext", - "Select", - "String", - "Tab", - "Text", - "Content" -); -foreach ($maskIcons as $maskIcon) { - $iconRegistry->registerIcon( - 'mask-fieldtype-' . $maskIcon, 'TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider', array( +defined('TYPO3_MODE') or die(); + +(function ($extkey) { + + // initialize mask utility for various things + $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(TYPO3\CMS\Extbase\Object\ObjectManager::class); + $storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(MASK\Mask\Domain\Repository\StorageRepository::class); + $fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(MASK\Mask\Helper\FieldHelper::class); + $typoScriptCodeGenerator = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(MASK\Mask\CodeGenerator\TyposcriptCodeGenerator::class); + $settingsService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(MASK\Mask\Domain\Service\SettingsService::class); + $configuration = $storageRepository->load(); + $settings = $settingsService->get(); + + // Register Icons needed in the backend module + $iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(TYPO3\CMS\Core\Imaging\IconRegistry::class); + $maskIcons = [ + 'Check', + 'Date', + 'Datetime', + 'File', + 'Float', + 'Inline', + 'Integer', + 'Link', + 'Radio', + 'Richtext', + 'Select', + 'String', + 'Tab', + 'Text', + 'Content' + ]; + foreach ($maskIcons as $maskIcon) { + $iconRegistry->registerIcon('mask-fieldtype-' . $maskIcon, 'TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider', array( 'source' => 'EXT:mask/Resources/Public/Icons/Fieldtypes/' . $maskIcon . '.svg' - ) - ); -} - -// Add all the typoscript we need in the correct files -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(''); -$tsConfig = $typoScriptCodeGenerator->generateTsConfig($configuration); -$pageTs = $typoScriptCodeGenerator->generatePageTyposcript($configuration); -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig($tsConfig); -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig($pageTs); - -$setupTs = $typoScriptCodeGenerator->generateSetupTyposcript($configuration, $settings); -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptSetup($setupTs); - -// for conditions on tt_content -if (!function_exists('user_mask_contentType')) { - - function user_mask_contentType($param = "") - { - static $cTypeCache = []; - - if (isset($_REQUEST["edit"]["tt_content"]) && is_array($_REQUEST["edit"]["tt_content"])) { - $field = explode("|", $param); - $request = $_REQUEST; - $first = array_shift($request["edit"]["tt_content"]); - - if ($first == "new") { // if new element - if ($_REQUEST["defVals"]["tt_content"]["CType"] == $field[1]) { - return true; - } else { - return false; + )); + } + + // Add all the typoscript we need in the correct files + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(''); + $tsConfig = $typoScriptCodeGenerator->generateTsConfig($configuration); + $pageTs = $typoScriptCodeGenerator->generatePageTyposcript($configuration); + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig($tsConfig); + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig($pageTs); + + $setupTs = $typoScriptCodeGenerator->generateSetupTyposcript($configuration, $settings); + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptSetup($setupTs); + + // for conditions on tt_content + if (!function_exists('user_mask_contentType')) { + + function user_mask_contentType($param = '') + { + static $cTypeCache = []; + + if (isset($_REQUEST['edit']['tt_content']) && is_array($_REQUEST['edit']['tt_content'])) { + $field = explode('|', $param); + $request = $_REQUEST; + $first = array_shift($request['edit']['tt_content']); + + if ($first === 'new') { // if new element + return $_REQUEST['defVals']['tt_content']['CType'] === $field[1]; } - } else { // if element exists - $uid = intval(key($_REQUEST["edit"]["tt_content"])); + // if element exists + $uid = (int)key($_REQUEST['edit']['tt_content']); if (!isset($cTypeCache[$uid])) { /** @var \TYPO3\CMS\Core\Database\ConnectionPool $connection */ @@ -77,122 +72,102 @@ function user_mask_contentType($param = "") /** @var \TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction $deletedRestriction */ $deletedRestriction = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction::class); $queryBuilder->getRestrictions()->removeAll()->add($deletedRestriction); - $cTypeCache[$uid] = $queryBuilder->select($field[0]) - ->from('tt_content') - ->where($queryBuilder->expr()->eq('uid', $uid)) - ->execute() - ->fetchColumn(0); + $cTypeCache[$uid] = $queryBuilder->select($field[0])->from('tt_content')->where($queryBuilder->expr()->eq('uid', $uid))->execute()->fetchColumn(0); } return $cTypeCache[$uid] == $field[1]; } - } else { // if content element is loaded by ajax, then it's ok - if (is_array($_REQUEST["ajax"])) { - return true; - } else { - return false; - } + return is_array($_REQUEST['ajax']); } } -} - -// for conditions on the backend-layouts -if (!function_exists('user_mask_beLayout')) { - - function user_mask_beLayout($layout = null) - { - // get current page uid: - if (is_array($_REQUEST["data"]["pages"])) { // after saving page - $uid = intval(key($_REQUEST["data"]["pages"])); - } elseif ($GLOBALS["SOBE"]->editconf["pages"]) { // after opening pages - $uid = intval(key($GLOBALS["SOBE"]->editconf["pages"])); - } else { - if ($GLOBALS["_SERVER"]["HTTP_REFERER"] != "") { - $url = $GLOBALS["_SERVER"]["HTTP_REFERER"]; - $queryString = parse_url($url, PHP_URL_QUERY); - $result = array(); - parse_str($queryString, $result); - if ($result["id"]) { - $uid = (int)$result["id"]; + + // for conditions on the backend-layouts + if (!function_exists('user_mask_beLayout')) { + + function user_mask_beLayout($layout = null) + { + // get current page uid: + if (is_array($_REQUEST['data']['pages'])) { // after saving page + $uid = (int) key($_REQUEST['data']['pages']); + } elseif ($GLOBALS['SOBE']->editconf['pages']) { // after opening pages + $uid = (int) key($GLOBALS['SOBE']->editconf['pages']); + } else { + if ($GLOBALS['_SERVER']['HTTP_REFERER'] !== '') { + $url = $GLOBALS['_SERVER']['HTTP_REFERER']; + $queryString = parse_url($url, PHP_URL_QUERY); + $result = array(); + parse_str($queryString, $result); + if ($result['id']) { + $uid = (int)$result['id']; + } } } - } - if ($uid) { - /** @var \TYPO3\CMS\Core\Database\Connection $connection */ - $connection = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\ConnectionPool::class)->getConnectionForTable('pages'); - $query = $connection->createQueryBuilder(); - /** @var \TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction $deletedRestriction */ - $deletedRestriction = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction::class); - $query->getRestrictions()->removeAll()->add($deletedRestriction); - $data = $query->select('backend_layout', 'backend_layout_next_level') - ->from('pages') - ->where($query->expr()->eq('uid', $uid)) - ->execute() - ->fetch(\Doctrine\DBAL\FetchMode::ASSOCIATIVE); - - $backend_layout = $data["backend_layout"]; - $backend_layout_next_level = $data["backend_layout_next_level"]; - - if ($backend_layout !== "") { // If backend_layout is set on current page - if (in_array($backend_layout, - [$layout, "pagets__" . $layout])) { // Check backend_layout of current page - return true; - } else { - return false; + if ($uid) { + /** @var \TYPO3\CMS\Core\Database\Connection $connection */ + $connection = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\ConnectionPool::class)->getConnectionForTable('pages'); + $query = $connection->createQueryBuilder(); + /** @var \TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction $deletedRestriction */ + $deletedRestriction = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction::class); + $query->getRestrictions()->removeAll()->add($deletedRestriction); + $data = $query->select('backend_layout', 'backend_layout_next_level')->from('pages')->where($query->expr()->eq('uid', $uid))->execute() + ->fetch(\Doctrine\DBAL\FetchMode::ASSOCIATIVE); + + $backend_layout = $data['backend_layout']; + $backend_layout_next_level = $data['backend_layout_next_level']; + + if ($backend_layout !== '') { // If backend_layout is set on current page + return in_array($backend_layout, [$layout, 'pagets__' . $layout]); } - } elseif ($backend_layout_next_level !== "") { // If backend_layout_next_level is set on current page - if (in_array($backend_layout_next_level, - [$layout, "pagets__" . $layout])) { // Check backend_layout_next_level of current page - return true; - } else { - return false; + + if ($backend_layout_next_level !== '') { // If backend_layout_next_level is set on current page + return in_array($backend_layout_next_level, [$layout, 'pagets__' . $layout]); } - } else { // If backend_layout and backend_layout_next_level is not set on current page, check backend_layout_next_level on rootline - $sysPage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository'); + + // If backend_layout and backend_layout_next_level is not set on current page, check backend_layout_next_level on rootline + $sysPage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(TYPO3\CMS\Core\Domain\Repository\PageRepository::class); try { $rootline = $sysPage->getRootLine($uid, ''); } catch (Exception $e) { $rootline = []; } foreach ($rootline as $page) { - if (in_array($page["backend_layout_next_level"], [$layout, "pagets__" . $layout])) { + if (in_array($page['backend_layout_next_level'], [$layout, 'pagets__' . $layout])) { return true; } } - return false; } - } else { return false; } } -} - -// set root line fields -if ($json['pages']['tca']) { - $rootlineFields = explode(",", $GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields']); - foreach ($json['pages']['tca'] as $fieldKey => $value) { - $formType = $fieldHelper->getFormType($fieldKey, "", "pages"); - if ($formType !== "Tab") { - // Add addRootLineFields for all page fields - $rootlineFields[] = $fieldKey; + + // set root line fields + if ($json['pages']['tca']) { + $rootlineFields = explode(',', $GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields']); + foreach ($json['pages']['tca'] as $fieldKey => $value) { + $formType = $fieldHelper->getFormType($fieldKey, '', 'pages'); + if ($formType !== 'Tab') { + // Add addRootLineFields for all page fields + $rootlineFields[] = $fieldKey; + } } + $GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields'] = implode(',', $rootlineFields); } - $GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields'] = implode(",", $rootlineFields); -} - -// SQL inject: -$signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\SignalSlot\\Dispatcher'); -$signalSlotDispatcher->connect('TYPO3\\CMS\\Install\\Service\\SqlExpectedSchemaService', 'tablesDefinitionIsBeingBuilt', - 'MASK\\Mask\\CodeGenerator\\SqlCodeGenerator', 'addDatabaseTablesDefinition'); - -// Enhance Fluid Output with overridden FluidTemplateContentObject -$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects']['TYPO3\\CMS\\Frontend\\ContentObject\\FluidTemplateContentObject'] = array( - 'className' => 'MASK\\Mask\\Fluid\\FluidTemplateContentObject' -); - -// Hook to override tt_content backend_preview -$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem'][$_EXTKEY] = \MASK\Mask\Hooks\PageLayoutViewDrawItem::class; -// Hook to override colpos check for unused tt_content elements -$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['record_is_used'] [] = MASK\Mask\Hooks\PageLayoutViewHook::class . '->contentIsUsed'; + + // SQL inject: + $signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class); + $signalSlotDispatcher->connect(TYPO3\CMS\Install\Service\SqlExpectedSchemaService::class, 'tablesDefinitionIsBeingBuilt', MASK\Mask\CodeGenerator\SqlCodeGenerator::class, + 'addDatabaseTablesDefinition'); + + // Enhance Fluid Output with overridden FluidTemplateContentObject + $GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][TYPO3\CMS\Frontend\ContentObject\FluidTemplateContentObject::class] = array( + 'className' => MASK\Mask\Fluid\FluidTemplateContentObject::class + ); + + // Hook to override tt_content backend_preview + $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem'][$extkey] = \MASK\Mask\Hooks\PageLayoutViewDrawItem::class; + // Hook to override colpos check for unused tt_content elements + $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['record_is_used'] [] = MASK\Mask\Hooks\PageLayoutViewHook::class . '->contentIsUsed'; + +})('mask'); diff --git a/ext_tables.php b/ext_tables.php index abbe0454..5a28d0c5 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -1,40 +1,43 @@ 'list, new, create, edit, update, delete, purge, generate, showHtml, createMissingFolders, hide, activate, createHtml', - 'WizardPage' => 'list, new, create, edit, update, delete, showHtml', - ), array( - 'access' => 'admin', - 'icon' => 'EXT:' . $_EXTKEY . '/Resources/Public/Icons/module-mask_wizard.svg', - 'labels' => 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_mask.xlf', - ) - ); -} -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile($_EXTKEY, 'Configuration/TypoScript', 'Mask'); - -// include css for styling of backend preview of mask content elements -$TBE_STYLES['skins']['mask']['name'] = 'mask'; -$TBE_STYLES['skins']['mask']['stylesheetDirectories'][] = 'EXT:mask/Resources/Public/Styles/Backend/'; -//$TBE_STYLES['skins']['mask']['stylesheetDirectories'][] = "/" . $settings["backend"]; - -$storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Domain\\Repository\\StorageRepository'); -$configuration = $storageRepository->load(); - -if (!empty($configuration)) { - $tcaCodeGenerator = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\CodeGenerator\\TcaCodeGenerator'); - - // allow all inline tables on standard pages - $tcaCodeGenerator->allowInlineTablesOnStandardPages($configuration); -} +defined('TYPO3_MODE') or die(); + +(function ($extkey) { + + if (TYPO3_MODE === 'BE') { + + /** + * Registers a Backend Module + */ + \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule( + $extkey, + 'tools', // Make module a submodule of 'admin' + 'mask', // Submodule key + 'top', // Position + [ + \MASK\Mask\Controller\WizardContentController::class => 'list, new, create, edit, update, delete, purge, generate, showHtml, createMissingFolders, hide, activate, createHtml', + \MASK\Mask\Controller\WizardPageController::class => 'list, new, create, edit, update, delete, showHtml', + ], [ + 'access' => 'admin', + 'icon' => 'EXT:' . $extkey . '/Resources/Public/Icons/module-mask_wizard.svg', + 'labels' => 'LLL:EXT:' . $extkey . '/Resources/Private/Language/locallang_mask.xlf', + ] + ); + } + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile($extkey, 'Configuration/TypoScript', 'Mask'); + + // include css for styling of backend preview of mask content elements + $TBE_STYLES['skins']['mask']['name'] = 'mask'; + $TBE_STYLES['skins']['mask']['stylesheetDirectories'][] = 'EXT:' . $extkey . '/Resources/Public/Styles/Backend/'; + //$TBE_STYLES['skins']['mask']['stylesheetDirectories'][] = "/" . $settings["backend"]; + + $storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(MASK\Mask\Domain\Repository\StorageRepository::class); + $configuration = $storageRepository->load(); + + if (!empty($configuration)) { + $tcaCodeGenerator = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(MASK\Mask\CodeGenerator\TcaCodeGenerator::class); + + // allow all inline tables on standard pages + $tcaCodeGenerator->allowInlineTablesOnStandardPages($configuration); + } + +})('mask'); From b9851631c33b12bcb5f6b468b8a267737848bc86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Venne?= Date: Fri, 10 Jan 2020 16:07:59 +0100 Subject: [PATCH 07/93] [TASK] use UriBuilder class for backend routes --- Classes/Hooks/PageLayoutViewDrawItem.php | 6 ++++-- Classes/ViewHelpers/ConfigureExtensionViewHelper.php | 6 +++++- Classes/ViewHelpers/EditLinkViewHelper.php | 5 ++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Classes/Hooks/PageLayoutViewDrawItem.php b/Classes/Hooks/PageLayoutViewDrawItem.php index ec2feeab..2e26bf9a 100644 --- a/Classes/Hooks/PageLayoutViewDrawItem.php +++ b/Classes/Hooks/PageLayoutViewDrawItem.php @@ -33,6 +33,7 @@ use MASK\Mask\Domain\Service\SettingsService; use MASK\Mask\Helper\InlineHelper; use MASK\Mask\Utility\GeneralUtility as MaskUtility; +use TYPO3\CMS\Backend\Routing\UriBuilder; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Object\ObjectManager; @@ -151,8 +152,9 @@ public function preProcess( ], 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') ]; - $editElementUrl = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('record_edit', - $editElementUrlParameters); + $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); + $editElementUrl = $uriBuilder->buildUriFromRoute('record_edit', $editElementUrlParameters); + $headerContent = '' . $elementLabel . '
        '; $itemContent .= '
        '; $itemContent .= $content; diff --git a/Classes/ViewHelpers/ConfigureExtensionViewHelper.php b/Classes/ViewHelpers/ConfigureExtensionViewHelper.php index 07f2f17e..4779d52e 100644 --- a/Classes/ViewHelpers/ConfigureExtensionViewHelper.php +++ b/Classes/ViewHelpers/ConfigureExtensionViewHelper.php @@ -2,7 +2,9 @@ namespace MASK\Mask\ViewHelpers; +use TYPO3\CMS\Backend\Routing\UriBuilder; use TYPO3\CMS\Backend\Utility\BackendUtility; +use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; /** @@ -29,7 +31,9 @@ class ConfigureExtensionViewHelper extends AbstractViewHelper */ public function render() { - $url = BackendUtility::getModuleUrl('tools_toolssettings'); + $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); + $url = $uriBuilder->buildUriFromRoute('record_edit'); + return '' . $this->renderChildren() . ''; } } diff --git a/Classes/ViewHelpers/EditLinkViewHelper.php b/Classes/ViewHelpers/EditLinkViewHelper.php index 433b8dd7..cdcbd08a 100644 --- a/Classes/ViewHelpers/EditLinkViewHelper.php +++ b/Classes/ViewHelpers/EditLinkViewHelper.php @@ -2,6 +2,7 @@ namespace MASK\Mask\ViewHelpers; +use TYPO3\CMS\Backend\Routing\UriBuilder; use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -50,7 +51,9 @@ public function render() ], 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') ]; - $uri = BackendUtility::getModuleUrl('record_edit', $urlParameters); + $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); + $uri = $uriBuilder->buildUriFromRoute('record_edit', $urlParameters); + // $uri = BackendUtility::getModuleUrl('record_edit', $urlParameters); $this->tag->addAttribute('href', $uri); } From 96455e0ef7e6bc8f1acc65d7180be3c5de72cd1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Venne?= Date: Fri, 10 Jan 2020 16:09:30 +0100 Subject: [PATCH 08/93] [TASK] remove deprected method for rootline --- .../Domain/Repository/BackendLayoutRepository.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Classes/Domain/Repository/BackendLayoutRepository.php b/Classes/Domain/Repository/BackendLayoutRepository.php index bf9f4379..53b8cd24 100644 --- a/Classes/Domain/Repository/BackendLayoutRepository.php +++ b/Classes/Domain/Repository/BackendLayoutRepository.php @@ -31,7 +31,8 @@ use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Frontend\Page\PageRepository; +use TYPO3\CMS\Core\Domain\Repository\PageRepository; +use TYPO3\CMS\Core\Utility\RootlineUtility; /** * Repository for \TYPO3\CMS\Extbase\Domain\Model\BackendLayout. @@ -125,9 +126,15 @@ public function findIdentifierByPid($pid) } elseif ($backend_layout_next_level !== "") { // If backend_layout_next_level is set on current page return $backend_layout_next_level; } else { // If backend_layout and backend_layout_next_level is not set on current page, check backend_layout_next_level on rootline - $sysPage = GeneralUtility::makeInstance(PageRepository::class); + $rootLineUtility = GeneralUtility::makeInstance(RootlineUtility::class, $pid); // , $MP, $this->context); + // try { + // return $rootline->get(); + // \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::getPageAndRootline(); + /** @var PageRepository $sysPage */ + $sysPage = GeneralUtility::makeInstance(PageRepository::class); try { - $rootline = $sysPage->getRootLine($pid, ''); + $rootline = $rootLineUtility->get(); + // $rootline = $sysPage->getRootLine($pid, ''); } catch (\RuntimeException $ex) { $rootline = []; } From 0b8e739ffe24550e6a3fd285203ae3a2f43518ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Venne?= Date: Fri, 10 Jan 2020 16:09:48 +0100 Subject: [PATCH 09/93] [BUGFIX] dirty fix missing table error --- ext_tables.sql | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 ext_tables.sql diff --git a/ext_tables.sql b/ext_tables.sql new file mode 100644 index 00000000..e1fceb90 --- /dev/null +++ b/ext_tables.sql @@ -0,0 +1,41 @@ +# +# Table structure for table 'tx_mask_domain_model_backendlayout' +# +CREATE TABLE tx_mask_domain_model_backendlayout +( + uid int(11) NOT NULL auto_increment, + pid int(11) DEFAULT '0' NOT NULL, + + tstamp int(11) unsigned DEFAULT '0' NOT NULL, + crdate int(11) unsigned DEFAULT '0' NOT NULL, + cruser_id int(11) unsigned DEFAULT '0' NOT NULL, + deleted SMALLINT unsigned DEFAULT '0' NOT NULL, + hidden SMALLINT unsigned DEFAULT '0' NOT NULL, + starttime int(11) unsigned DEFAULT '0' NOT NULL, + endtime int(11) unsigned DEFAULT '0' NOT NULL, + + t3ver_oid int(11) DEFAULT '0' NOT NULL, + t3ver_id int(11) DEFAULT '0' NOT NULL, + t3ver_wsid int(11) DEFAULT '0' NOT NULL, + t3ver_label varchar(255) DEFAULT '' NOT NULL, + t3ver_state SMALLINT DEFAULT '0' NOT NULL, + t3ver_stage int(11) DEFAULT '0' NOT NULL, + t3ver_count int(11) DEFAULT '0' NOT NULL, + t3ver_tstamp int(11) DEFAULT '0' NOT NULL, + t3ver_move_id int(11) DEFAULT '0' NOT NULL, + + sys_language_uid int(11) DEFAULT '0' NOT NULL, + l10n_parent int(11) DEFAULT '0' NOT NULL, + l10n_diffsource mediumblob, + l10n_state text, + + PRIMARY KEY (uid), + KEY parent (pid), + KEY t3ver_oid (t3ver_oid, t3ver_wsid), + KEY language (l10n_parent, sys_language_uid), + + parentid int(11) DEFAULT '0' NOT NULL, + parenttable varchar(255) DEFAULT '', + sorting int(11) DEFAULT '0' NOT NULL + +); From 3be4009011353ea7ca1aedfface1942e6706912d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Venne?= Date: Fri, 10 Jan 2020 16:10:20 +0100 Subject: [PATCH 10/93] [TASK] minor improvements code quality --- Classes/CodeGenerator/SqlCodeGenerator.php | 14 ++++--- Classes/Domain/Model/BackendLayout.php | 2 +- .../ContentElementIconProvider.php | 38 +++++++++---------- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/Classes/CodeGenerator/SqlCodeGenerator.php b/Classes/CodeGenerator/SqlCodeGenerator.php index 811dce2b..593cb96d 100644 --- a/Classes/CodeGenerator/SqlCodeGenerator.php +++ b/Classes/CodeGenerator/SqlCodeGenerator.php @@ -27,6 +27,7 @@ * ************************************************************* */ use Doctrine\DBAL\DBALException; +use MASK\Mask\Domain\Repository\StorageRepository; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Database\Schema\SchemaMigrator; use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; @@ -102,7 +103,8 @@ protected function performDbUpdates(array $sqlStatements) */ public function updateDatabase() { - $storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Domain\\Repository\\StorageRepository'); + /** @var StorageRepository $storageRepository */ + $storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(MASK\Mask\Domain\Repository\StorageRepository::class); $json = $storageRepository->load(); $sqlStatements = $this->getSqlByConfiguration($json); if (count($sqlStatements) > 0) { @@ -114,7 +116,7 @@ public function updateDatabase() /** * returns sql statements of all elements and pages and irre * @param array $json - * @return string + * @return array */ public function getSqlByConfiguration($json) { @@ -170,16 +172,16 @@ public function getSqlByConfiguration($json) );\n"; } - foreach ($json[$type]["sql"] as $field) { - if ($field) { - foreach ($field as $table => $fields) { + foreach ($json[$type]["sql"] as $tables) { + if ($tables) { + foreach ($tables as $table => $fields) { if ($fields) { foreach ($fields as $field => $definition) { $sql_content[] = "CREATE TABLE " . $table . " (\n\t" . $field . " " . $definition . "\n);\n"; // if this field is a content field, also add parent columns $fieldType = $fieldHelper->getFormType($field, "", $table); - if ($fieldType == "Content") { + if ($fieldType === "Content") { $sql_content[] = "CREATE TABLE tt_content (\n\t" . $field . "_parent" . " " . $definition . ",\n\t" . "KEY " . $field . " (" . $field . "_parent,pid,deleted)" . "\n);\n"; } } diff --git a/Classes/Domain/Model/BackendLayout.php b/Classes/Domain/Model/BackendLayout.php index 63f2fb79..50bc488b 100644 --- a/Classes/Domain/Model/BackendLayout.php +++ b/Classes/Domain/Model/BackendLayout.php @@ -87,7 +87,7 @@ public function setTitle($title) * * @return int the uid, will not be empty */ - public function getUid() + public function getUid(): ?int { return $this->uid; } diff --git a/Classes/Imaging/IconProvider/ContentElementIconProvider.php b/Classes/Imaging/IconProvider/ContentElementIconProvider.php index 49099234..570ab3e5 100644 --- a/Classes/Imaging/IconProvider/ContentElementIconProvider.php +++ b/Classes/Imaging/IconProvider/ContentElementIconProvider.php @@ -2,6 +2,7 @@ namespace MASK\Mask\Imaging\IconProvider; +use TYPO3\CMS\Core\Core\Environment; use TYPO3\CMS\Core\Imaging\Icon; use TYPO3\CMS\Core\Imaging\IconProviderInterface; use TYPO3\CMS\Core\Utility\PathUtility; @@ -77,11 +78,11 @@ public function prepareIconMarkup(Icon $icon, array $options = array()) throw new \InvalidArgumentException('The option "contentElementKey" is required and must not be empty', 1440754978); } - $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager'); - $this->storageRepository = $this->objectManager->get("MASK\Mask\Domain\Repository\StorageRepository"); - $this->settingsService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Domain\\Service\\SettingsService'); + $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(TYPO3\CMS\Extbase\Object\ObjectManager::class); + $this->storageRepository = $this->objectManager->get(MASK\Mask\Domain\Repository\StorageRepository::class); + $this->settingsService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(MASK\Mask\Domain\Service\SettingsService::class); $this->extSettings = $this->settingsService->get(); - $this->contentElement = $this->storageRepository->loadElement("tt_content", $options["contentElementKey"]); + $this->contentElement = $this->storageRepository->loadElement('tt_content', $options['contentElementKey']); $icon->setMarkup($this->generateMarkup($icon, $options)); } @@ -105,10 +106,10 @@ protected function generateMarkup(Icon $icon, array $options) $color = $this->getColor($this->contentElement); if ($color) { - $styles[] = "color: #" . $color; + $styles[] = 'color: #' . $color; } if (count($styles)) { - $markup = ''; } else { $markup = ''; @@ -116,15 +117,15 @@ protected function generateMarkup(Icon $icon, array $options) } else { if ($previewIconAvailable) { $markup = '' . $this->contentElement['; + '/')) . '" alt="' . $this->contentElement['label'] . '" title="' . $this->contentElement['label'] . '"/>'; } else { $color = $this->getColor($this->contentElement); if ($color) { - $styles[] = "background-color: #" . $color; + $styles[] = 'background-color: #' . $color; } - $styles[] = "color: #fff"; - $markup = '' . mb_substr($this->contentElement["label"], 0, 1) . ''; + $styles[] = 'color: #fff'; + $markup = '' . mb_substr($this->contentElement['label'], 0, 1) . ''; } } @@ -139,11 +140,8 @@ protected function generateMarkup(Icon $icon, array $options) */ protected function isPreviewIconAvailable($key) { - if (file_exists(PATH_site . $this->getPreviewIconPath($key))) { - return true; - } else { - return false; - } + $pathSite = Environment::getPublicPath(); + return file_exists($pathSite . $this->getPreviewIconPath($key)); } /** @@ -155,7 +153,7 @@ protected function isPreviewIconAvailable($key) */ protected function isFontAwesomeKeyAvailable($element) { - return trim($element["icon"]) != ""; + return trim($element['icon']) !== ''; } /** @@ -165,7 +163,7 @@ protected function isFontAwesomeKeyAvailable($element) */ protected function getPreviewIconPath($key) { - return $this->extSettings["preview"] . $key . '.png'; + return $this->extSettings['preview'] . $key . '.png'; } /** @@ -176,7 +174,7 @@ protected function getPreviewIconPath($key) */ protected function getFontAwesomeKey($element) { - return trim(str_replace("fa-", "", $element["icon"])); + return trim(str_replace('fa-', '', $element['icon'])); } /** @@ -187,6 +185,6 @@ protected function getFontAwesomeKey($element) */ protected function getColor($element) { - return trim(str_replace("#", "", $element["color"])); + return trim(str_replace('#', '', $element['color'])); } } From bfa8accf4f8b83a7e5a039c81f67f6278923839b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Venne?= Date: Mon, 13 Jan 2020 10:17:46 +0100 Subject: [PATCH 11/93] [BUGFIX] use absolute namespaces --- .../CodeGenerator/AbstractCodeGenerator.php | 2 +- Classes/CodeGenerator/HtmlCodeGenerator.php | 2 +- Classes/CodeGenerator/SqlCodeGenerator.php | 4 +- Classes/CodeGenerator/TcaCodeGenerator.php | 14 ++-- .../Domain/Repository/StorageRepository.php | 4 +- Classes/Helper/FieldHelper.php | 2 +- Classes/Helper/InlineHelper.php | 73 ++++++++++--------- Classes/ItemsProcFuncs/CTypeList.php | 4 +- Classes/Utility/GeneralUtility.php | 4 +- Classes/ViewHelpers/EvalViewHelper.php | 4 +- Classes/ViewHelpers/FormTypeViewHelper.php | 2 +- .../ViewHelpers/JsOpenParamsViewHelper.php | 4 +- Classes/ViewHelpers/LabelViewHelper.php | 2 +- Classes/ViewHelpers/LinkoptionViewHelper.php | 4 +- Classes/ViewHelpers/MultiuseViewHelper.php | 2 +- .../ViewHelpers/RteTransformViewHelper.php | 4 +- Classes/ViewHelpers/TcaViewHelper.php | 2 +- 17 files changed, 67 insertions(+), 66 deletions(-) diff --git a/Classes/CodeGenerator/AbstractCodeGenerator.php b/Classes/CodeGenerator/AbstractCodeGenerator.php index 80b1278f..98bb40e1 100644 --- a/Classes/CodeGenerator/AbstractCodeGenerator.php +++ b/Classes/CodeGenerator/AbstractCodeGenerator.php @@ -47,7 +47,7 @@ abstract class AbstractCodeGenerator public function __construct(\MASK\Mask\Domain\Repository\StorageRepository $storageRepository = null) { if (!$storageRepository) { - $this->storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Domain\\Repository\\StorageRepository'); + $this->storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\Domain\Repository\StorageRepository::class); } else { $this->storageRepository = $storageRepository; } diff --git a/Classes/CodeGenerator/HtmlCodeGenerator.php b/Classes/CodeGenerator/HtmlCodeGenerator.php index a09a9257..88bcb69a 100644 --- a/Classes/CodeGenerator/HtmlCodeGenerator.php +++ b/Classes/CodeGenerator/HtmlCodeGenerator.php @@ -66,7 +66,7 @@ public function generateHtml($key, $table) protected function generateFieldHtml($fieldKey, $elementKey, $table, $datafield = "data") { $html = ""; - $fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); + $fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\Helper\FieldHelper::class); switch ($fieldHelper->getFormType($fieldKey, $elementKey, $table)) { case "Check": $html .= "{f:if(condition: " . $datafield . "." . $fieldKey . ", then: 'On', else: 'Off')}
        \n\n"; diff --git a/Classes/CodeGenerator/SqlCodeGenerator.php b/Classes/CodeGenerator/SqlCodeGenerator.php index 593cb96d..aba6a367 100644 --- a/Classes/CodeGenerator/SqlCodeGenerator.php +++ b/Classes/CodeGenerator/SqlCodeGenerator.php @@ -123,7 +123,7 @@ public function getSqlByConfiguration($json) $sql_content = array(); $types = array_keys($json); $nonIrreTables = array("pages", "tt_content"); - $fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); + $fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\Helper\FieldHelper::class); // Generate SQL-Statements if ($types) { @@ -205,7 +205,7 @@ public function getSqlByConfiguration($json) */ public function addDatabaseTablesDefinition(array $sqlString) { - $storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Domain\\Repository\\StorageRepository'); + $storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\Domain\Repository\StorageRepository::class); $json = $storageRepository->load(); $sql = $this->getSqlByConfiguration($json); $mergedSqlString = array_merge($sqlString, $sql); diff --git a/Classes/CodeGenerator/TcaCodeGenerator.php b/Classes/CodeGenerator/TcaCodeGenerator.php index b8da61b1..d2dcc7b1 100644 --- a/Classes/CodeGenerator/TcaCodeGenerator.php +++ b/Classes/CodeGenerator/TcaCodeGenerator.php @@ -81,7 +81,7 @@ public function setInlineTca($json) public function setElementsTca($tca) { - $fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); + $fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\Helper\FieldHelper::class); $defaultTabs = ",--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance,--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.frames;frames,--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.appearanceLinks;appearanceLinks,--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language,--palette--;;language,--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,--palette--;;hidden,--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.access;access,--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:categories,--div--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_category.tabs.category,categories,--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:notes,rowDescription,--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:extended"; // add gridelements fields, to make mask work with gridelements out of the box @@ -132,7 +132,7 @@ public function setElementsTca($tca) } } $fields = implode(",", $fieldArray); - + $GLOBALS['TCA']['tt_content']['ctrl']['typeicon_classes']["mask_" . $elementvalue["key"]] = 'mask-ce-' . $elementvalue["key"]; $GLOBALS['TCA']["tt_content"]["types"]["mask_" . $elementvalue["key"]]["columnsOverrides"]["bodytext"]["config"]['richtextConfiguration'] = 'default'; $GLOBALS['TCA']["tt_content"]["types"]["mask_" . $elementvalue["key"]]["columnsOverrides"]["bodytext"]["config"]['enableRichtext'] = 1; @@ -150,7 +150,7 @@ public function setElementsTca($tca) */ public function setPageTca($tca) { - $fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); + $fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\Helper\FieldHelper::class); $prependTabs = "--div--;Content-Fields,"; if ($tca) { $i = 0; @@ -194,7 +194,7 @@ public function setPageTca($tca) */ public function generateFieldsTca($tca) { - $generalUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Utility\\GeneralUtility'); + $generalUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\Utility\GeneralUtility::class); $columns = array(); if ($tca) { foreach ($tca as $tcakey => $tcavalue) { @@ -202,7 +202,7 @@ public function generateFieldsTca($tca) if ($tcavalue) { foreach ($tcavalue as $fieldkey => $fieldvalue) { // Add File-Config for file-field - if ($fieldkey == "options" && $fieldvalue == "file") { + if ($fieldkey === "options" && $fieldvalue === "file") { $fieldName = $tcakey; $customSettingOverride = array( 'overrideChildTca' => array( @@ -468,8 +468,8 @@ public function generateTableTca($table, $tca) ), ); - $fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); - $generalUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Utility\\GeneralUtility'); + $fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\Helper\FieldHelper::class); + $generalUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\Utility\GeneralUtility::class); // now add all the fields that should be shown $prependTabs = "sys_language_uid, l10n_parent, l10n_diffsource, hidden, "; diff --git a/Classes/Domain/Repository/StorageRepository.php b/Classes/Domain/Repository/StorageRepository.php index 693c8fbc..bbf20b76 100644 --- a/Classes/Domain/Repository/StorageRepository.php +++ b/Classes/Domain/Repository/StorageRepository.php @@ -80,7 +80,7 @@ class StorageRepository */ public function __construct() { - $this->settingsService = GeneralUtility::makeInstance('MASK\\Mask\\Domain\\Service\\SettingsService'); + $this->settingsService = GeneralUtility::makeInstance(\MASK\Mask\Domain\Service\SettingsService::class); $this->extSettings = $this->settingsService->get(); } @@ -362,7 +362,7 @@ public function activate($type, $key) private function removeField($table, $field, $json, $remainingFields = array()) { - $this->fieldHelper = GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); + $this->fieldHelper = GeneralUtility::makeInstance(\MASK\Mask\Helper\FieldHelper::class); // check if this field is used in any other elements $elementsInUse = array(); diff --git a/Classes/Helper/FieldHelper.php b/Classes/Helper/FieldHelper.php index edac70f1..bf67ed80 100644 --- a/Classes/Helper/FieldHelper.php +++ b/Classes/Helper/FieldHelper.php @@ -47,7 +47,7 @@ class FieldHelper public function __construct(\MASK\Mask\Domain\Repository\StorageRepository $storageRepository = null) { if (!$storageRepository) { - $this->storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Domain\\Repository\\StorageRepository'); + $this->storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\Domain\Repository\StorageRepository::class); } else { $this->storageRepository = $storageRepository; } diff --git a/Classes/Helper/InlineHelper.php b/Classes/Helper/InlineHelper.php index 61638193..69b0ff47 100644 --- a/Classes/Helper/InlineHelper.php +++ b/Classes/Helper/InlineHelper.php @@ -30,6 +30,8 @@ use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Annotation\Inject; +use TYPO3\CMS\Core\Resource\FileRepository; +use TYPO3\CMS\Extbase\Object\ObjectManager; /** * Methods for working with inline fields (IRRE) @@ -40,8 +42,7 @@ class InlineHelper { /** - * @var TYPO3\CMS\Extbase\Object\ObjectManager - * @Inject() + * @var \TYPO3\CMS\Extbase\Object\ObjectManager */ protected $objectManager; @@ -67,7 +68,7 @@ class InlineHelper public function __construct(\MASK\Mask\Domain\Repository\StorageRepository $storageRepository = null) { if (!$storageRepository) { - $this->storageRepository = GeneralUtility::makeInstance('MASK\\Mask\\Domain\\Repository\\StorageRepository'); + $this->storageRepository = GeneralUtility::makeInstance(\MASK\Mask\Domain\Repository\StorageRepository::class); } else { $this->storageRepository = $storageRepository; } @@ -80,12 +81,12 @@ public function __construct(\MASK\Mask\Domain\Repository\StorageRepository $stor * @param string $table * @author Benjamin Butschell */ - public function addFilesToData(&$data, $table = "tt_content") + public function addFilesToData(&$data, $table = 'tt_content') { - if ($data["_LOCALIZED_UID"]) { - $uid = $data["_LOCALIZED_UID"]; + if ($data['_LOCALIZED_UID']) { + $uid = $data['_LOCALIZED_UID']; } else { - $uid = $data["uid"]; + $uid = $data['uid']; } // using is_numeric in favor to is_int @@ -93,23 +94,23 @@ public function addFilesToData(&$data, $table = "tt_content") if (!is_numeric($uid)) { return; } - $fieldHelper = GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); + $fieldHelper = GeneralUtility::makeInstance(\MASK\Mask\Helper\FieldHelper::class); if (!$this->objectManager) { - $this->objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager'); + $this->objectManager = GeneralUtility::makeInstance(ObjectManager::class); } $storage = $this->storageRepository->load(); /* @var $fileRepository \TYPO3\CMS\Core\Resource\FileRepository */ - $fileRepository = $this->objectManager->get("TYPO3\CMS\Core\Resource\FileRepository"); - $contentFields = array("media", "image", "assets"); - if ($storage[$table]["tca"]) { - foreach ($storage[$table]["tca"] as $fieldKey => $field) { + $fileRepository = $this->objectManager->get(FileRepository::class); + $contentFields = array('media', 'image', 'assets'); + if ($storage[$table]['tca']) { + foreach ($storage[$table]['tca'] as $fieldKey => $field) { $contentFields[] = $fieldKey; } } if ($contentFields) { foreach ($contentFields as $fieldKey) { - if ($fieldHelper->getFormType($fieldKey, "", $table) == "File") { + if ($fieldHelper->getFormType($fieldKey, '', $table) === 'File') { $data[$fieldKey] = $fileRepository->findByRelation($table, $fieldKey, $uid); } } @@ -124,11 +125,11 @@ public function addFilesToData(&$data, $table = "tt_content") * @param string $cType * @author Benjamin Butschell */ - public function addIrreToData(&$data, $table = "tt_content", $cType = "") + public function addIrreToData(&$data, $table = 'tt_content', $cType = '') { - if ($cType == "") { - $cType = $data["CType"]; + if ($cType === '') { + $cType = $data['CType']; } $fieldHelper = GeneralUtility::makeInstance(FieldHelper::class); @@ -136,10 +137,10 @@ public function addIrreToData(&$data, $table = "tt_content", $cType = "") $elementFields = []; // if the table is tt_content, load the element and all its columns - if ($table == "tt_content") { - $element = $this->storageRepository->loadElement($table, str_replace("mask_", "", $cType)); - $elementFields = $element["columns"]; - } elseif ($table == "pages") { + if ($table === 'tt_content') { + $element = $this->storageRepository->loadElement($table, str_replace('mask_', '', $cType)); + $elementFields = $element['columns']; + } elseif ($table === 'pages') { // if the table is pages, then load the pid if (isset($data['uid'])) { @@ -152,7 +153,7 @@ public function addIrreToData(&$data, $table = "tt_content", $cType = "") $table, str_replace('pagets__', '', $backendLayoutIdentifier) ); - $elementFields = $element["columns"]; + $elementFields = $element['columns']; } else { // if no backendlayout was found, just load all fields, if there are fields @@ -174,17 +175,16 @@ public function addIrreToData(&$data, $table = "tt_content", $cType = "") foreach ($elementFields as $field) { $fieldKeyPrefix = $field; - $fieldKey = str_replace("tx_mask_", "", $field); + $fieldKey = str_replace('tx_mask_', '', $field); $type = $fieldHelper->getFormType($fieldKey, $cType, $table); // if it is of type inline and has to be filled (IRRE, FAL) - if ($type == "Inline") { - $elements = $this->getInlineElements($data, $fieldKeyPrefix, $cType, "parentid", $table); + if ($type === 'Inline') { + $elements = $this->getInlineElements($data, $fieldKeyPrefix, $cType, 'parentid', $table); $data[$fieldKeyPrefix] = $elements; // or if it is of type Content (Nested Content) and has to be filled - } elseif ($type == "Content") { - $elements = $this->getInlineElements($data, $fieldKeyPrefix, $cType, $fieldKeyPrefix . "_parent", - "tt_content", "tt_content"); + } elseif ($type === 'Content') { + $elements = $this->getInlineElements($data, $fieldKeyPrefix, $cType, $fieldKeyPrefix . '_parent', 'tt_content', 'tt_content'); $data[$fieldKeyPrefix] = $elements; } } @@ -207,8 +207,8 @@ public function getInlineElements( $data, $name, $cType, - $parentFieldName = "parentid", - $parenttable = "tt_content", + $parentFieldName = 'parentid', + $parenttable = 'tt_content', $childTable = null ) { // if the name of the child table is not explicitely given, take field key @@ -217,19 +217,20 @@ public function getInlineElements( } // If this method is called in backend, there is no $GLOBALS['TSFE'] - if (TYPO3_MODE == 'FE' && isset($GLOBALS['TSFE']->sys_language_uid)) { + if (TYPO3_MODE === 'FE' && isset($GLOBALS['TSFE']->sys_language_uid)) { $sysLangUid = $GLOBALS['TSFE']->sys_language_uid; $enableFields = $GLOBALS['TSFE']->cObj->enableFields($childTable); } else { $sysLangUid = $data['sys_language_uid']; - $enableFields = " AND " . $childTable . ".deleted = 0"; + $enableFields = ' AND ' . $childTable . '.deleted = 0'; } // by default, the uid of the parent is $data["uid"] - $parentUid = $data["uid"]; + $parentUid = $data['uid']; - if ($GLOBALS['TSFE']->sys_language_uid != 0 && $data["_LOCALIZED_UID"] != "") { - $parentUid = $data["_LOCALIZED_UID"]; + // @todo: JV use language aspect + if ($GLOBALS['TSFE']->sys_language_uid != 0 && $data['_LOCALIZED_UID'] != '') { + $parentUid = $data['_LOCALIZED_UID']; } $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($childTable); @@ -249,7 +250,7 @@ public function getInlineElements( // and recursively add them to an array $elements = array(); foreach ($rows as $element) { - if (TYPO3_MODE == 'FE') { + if (TYPO3_MODE === 'FE') { $GLOBALS['TSFE']->sys_page->versionOL($childTable, $element); } else { $element = BackendUtility::getRecordWSOL($childTable, $element['uid']); diff --git a/Classes/ItemsProcFuncs/CTypeList.php b/Classes/ItemsProcFuncs/CTypeList.php index 6ba9006e..63f57604 100644 --- a/Classes/ItemsProcFuncs/CTypeList.php +++ b/Classes/ItemsProcFuncs/CTypeList.php @@ -48,8 +48,8 @@ public function itemsProcFunc(&$params) { // if this tt_content element is inline element of mask if ($params["row"]["colPos"] == $this->colPos) { - $fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); - $this->storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Domain\\Repository\\StorageRepository'); + $fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\Helper\FieldHelper::class); + $this->storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\Domain\Repository\StorageRepository::class); if (isset($_REQUEST["ajax"]["context"])) { $ajaxContext = json_decode($_REQUEST["ajax"]["context"]); diff --git a/Classes/Utility/GeneralUtility.php b/Classes/Utility/GeneralUtility.php index 90af396d..eccf2e34 100755 --- a/Classes/Utility/GeneralUtility.php +++ b/Classes/Utility/GeneralUtility.php @@ -51,7 +51,7 @@ class GeneralUtility public function __construct(\MASK\Mask\Domain\Repository\StorageRepository $storageRepository = null) { if (!$storageRepository) { - $this->storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Domain\\Repository\\StorageRepository'); + $this->storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\Mask\Domain\Repository\StorageRepository'); } else { $this->storageRepository = $storageRepository; } @@ -94,7 +94,7 @@ public function getRteTransformMode($fieldKey, $type = "tt_content") $transformMode = ""; $matches = array(); if ($storage[$type]["tca"][$fieldKey]["defaultExtras"] != "") { - $re = "/(rte_transform\\[([a-z=_]+)\\])/"; + $re = "/(rte_transform\[([a-z=_]+)\])/"; preg_match($re, $storage[$type]["tca"][$fieldKey]["defaultExtras"], $matches); $transformMode = end($matches); } diff --git a/Classes/ViewHelpers/EvalViewHelper.php b/Classes/ViewHelpers/EvalViewHelper.php index 47063d68..95c9f8a2 100644 --- a/Classes/ViewHelpers/EvalViewHelper.php +++ b/Classes/ViewHelpers/EvalViewHelper.php @@ -53,8 +53,8 @@ public function render() $evalValue = $this->arguments['evalValue']; $field = $this->arguments['field']; - $this->generalUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Utility\\GeneralUtility'); - $this->fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); + $this->generalUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\Utility\GeneralUtility::class); + $this->fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\Helper\FieldHelper::class); if ($field) { if ($field["inlineParent"]) { diff --git a/Classes/ViewHelpers/FormTypeViewHelper.php b/Classes/ViewHelpers/FormTypeViewHelper.php index 7cd1e98f..b2da35fa 100644 --- a/Classes/ViewHelpers/FormTypeViewHelper.php +++ b/Classes/ViewHelpers/FormTypeViewHelper.php @@ -43,7 +43,7 @@ public function render() $fieldKey = $this->arguments['fieldKey']; $type = $this->arguments['type']; - $this->fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); + $this->fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\Helper\FieldHelper::class); $formType = $this->fieldHelper->getFormType($fieldKey, $elementKey, $type); return $formType; } diff --git a/Classes/ViewHelpers/JsOpenParamsViewHelper.php b/Classes/ViewHelpers/JsOpenParamsViewHelper.php index 4e9e3b2b..863bbfb9 100644 --- a/Classes/ViewHelpers/JsOpenParamsViewHelper.php +++ b/Classes/ViewHelpers/JsOpenParamsViewHelper.php @@ -53,8 +53,8 @@ public function render() $property = $this->arguments['property']; $field = $this->arguments['field']; - $this->generalUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Utility\\GeneralUtility'); - $this->fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); + $this->generalUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\Utility\GeneralUtility::class); + $this->fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\Helper\FieldHelper::class); if ($field) { if ($field["inlineParent"]) { diff --git a/Classes/ViewHelpers/LabelViewHelper.php b/Classes/ViewHelpers/LabelViewHelper.php index 68114447..f624ed60 100644 --- a/Classes/ViewHelpers/LabelViewHelper.php +++ b/Classes/ViewHelpers/LabelViewHelper.php @@ -42,7 +42,7 @@ public function render(): string $field = $this->arguments['field']; $table = $this->arguments['table']; - $this->fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); + $this->fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\Helper\FieldHelper::class); // if we have the whole field configuration if ($field) { // check if this field is in an repeating field diff --git a/Classes/ViewHelpers/LinkoptionViewHelper.php b/Classes/ViewHelpers/LinkoptionViewHelper.php index cee906c3..8537e594 100644 --- a/Classes/ViewHelpers/LinkoptionViewHelper.php +++ b/Classes/ViewHelpers/LinkoptionViewHelper.php @@ -54,8 +54,8 @@ public function render() $elementKey = $this->arguments['elementKey']; $evalValue = $this->arguments['evalValue']; - $this->generalUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Utility\\GeneralUtility'); - $this->fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); + $this->generalUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\Utility\GeneralUtility::class); + $this->fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\Helper\FieldHelper::class); $type = $this->fieldHelper->getFieldType($fieldKey, $elementKey); return $this->generalUtility->isBlindLinkOptionSet($fieldKey, $evalValue, $type); diff --git a/Classes/ViewHelpers/MultiuseViewHelper.php b/Classes/ViewHelpers/MultiuseViewHelper.php index b3b620f8..270ebe41 100644 --- a/Classes/ViewHelpers/MultiuseViewHelper.php +++ b/Classes/ViewHelpers/MultiuseViewHelper.php @@ -41,7 +41,7 @@ public function render() $key = $this->arguments['key']; $elementKey = $this->arguments['elementKey']; - $this->fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); + $this->fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\Helper\FieldHelper::class); $type = $this->fieldHelper->getFieldType($key, $elementKey); return $this->fieldHelper->getElementsWhichUseField($key, $type); diff --git a/Classes/ViewHelpers/RteTransformViewHelper.php b/Classes/ViewHelpers/RteTransformViewHelper.php index 4e447e81..ecd3051a 100644 --- a/Classes/ViewHelpers/RteTransformViewHelper.php +++ b/Classes/ViewHelpers/RteTransformViewHelper.php @@ -51,8 +51,8 @@ public function render() $elementKey = $this->arguments['elementKey']; $field = $this->arguments['field']; - $this->generalUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Utility\\GeneralUtility'); - $this->fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); + $this->generalUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\Utility\GeneralUtility::class); + $this->fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\Helper\FieldHelper::class); if ($field) { if ($field["inlineParent"]) { diff --git a/Classes/ViewHelpers/TcaViewHelper.php b/Classes/ViewHelpers/TcaViewHelper.php index 438cd587..4752f4c4 100644 --- a/Classes/ViewHelpers/TcaViewHelper.php +++ b/Classes/ViewHelpers/TcaViewHelper.php @@ -83,7 +83,7 @@ class TcaViewHelper extends AbstractViewHelper */ public function __construct(FieldHelper $fieldHelper = null) { - $this->fieldHelper = $fieldHelper ?? GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); + $this->fieldHelper = $fieldHelper ?? GeneralUtility::makeInstance(\MASK\Mask\Helper\FieldHelper::class); } public function initializeArguments() From d169ebde74eb45833efc3a71d61f03d09f7a7b8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Venne?= Date: Mon, 13 Jan 2020 10:23:55 +0100 Subject: [PATCH 12/93] [BUGFIX] fix wrong namespace --- Classes/CodeGenerator/SqlCodeGenerator.php | 2 +- Classes/Imaging/IconProvider/ContentElementIconProvider.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Classes/CodeGenerator/SqlCodeGenerator.php b/Classes/CodeGenerator/SqlCodeGenerator.php index aba6a367..5100f096 100644 --- a/Classes/CodeGenerator/SqlCodeGenerator.php +++ b/Classes/CodeGenerator/SqlCodeGenerator.php @@ -104,7 +104,7 @@ protected function performDbUpdates(array $sqlStatements) public function updateDatabase() { /** @var StorageRepository $storageRepository */ - $storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(MASK\Mask\Domain\Repository\StorageRepository::class); + $storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\Domain\Repository\StorageRepository::class); $json = $storageRepository->load(); $sqlStatements = $this->getSqlByConfiguration($json); if (count($sqlStatements) > 0) { diff --git a/Classes/Imaging/IconProvider/ContentElementIconProvider.php b/Classes/Imaging/IconProvider/ContentElementIconProvider.php index 570ab3e5..8c8878a4 100644 --- a/Classes/Imaging/IconProvider/ContentElementIconProvider.php +++ b/Classes/Imaging/IconProvider/ContentElementIconProvider.php @@ -79,8 +79,8 @@ public function prepareIconMarkup(Icon $icon, array $options = array()) 1440754978); } $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(TYPO3\CMS\Extbase\Object\ObjectManager::class); - $this->storageRepository = $this->objectManager->get(MASK\Mask\Domain\Repository\StorageRepository::class); - $this->settingsService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(MASK\Mask\Domain\Service\SettingsService::class); + $this->storageRepository = $this->objectManager->get(\MASK\Mask\Domain\Repository\StorageRepository::class); + $this->settingsService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\Domain\Service\SettingsService::class); $this->extSettings = $this->settingsService->get(); $this->contentElement = $this->storageRepository->loadElement('tt_content', $options['contentElementKey']); $icon->setMarkup($this->generateMarkup($icon, $options)); From 2df9942122850920e7537258c78d46bda8717aca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Venne?= Date: Mon, 13 Jan 2020 10:32:03 +0100 Subject: [PATCH 13/93] [BUGFIX] fix namespace --- Classes/Imaging/IconProvider/ContentElementIconProvider.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Classes/Imaging/IconProvider/ContentElementIconProvider.php b/Classes/Imaging/IconProvider/ContentElementIconProvider.php index 8c8878a4..1904bc16 100644 --- a/Classes/Imaging/IconProvider/ContentElementIconProvider.php +++ b/Classes/Imaging/IconProvider/ContentElementIconProvider.php @@ -78,7 +78,8 @@ public function prepareIconMarkup(Icon $icon, array $options = array()) throw new \InvalidArgumentException('The option "contentElementKey" is required and must not be empty', 1440754978); } - $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(TYPO3\CMS\Extbase\Object\ObjectManager::class); + /** @var \TYPO3\CMS\Extbase\Object\ObjectManager objectManager */ + $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class); $this->storageRepository = $this->objectManager->get(\MASK\Mask\Domain\Repository\StorageRepository::class); $this->settingsService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\Domain\Service\SettingsService::class); $this->extSettings = $this->settingsService->get(); From 06e105805ac98a5a7db4f77ba03df5a7147bb852 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Venne?= Date: Mon, 13 Jan 2020 14:19:28 +0100 Subject: [PATCH 14/93] [BUGFIX] fix missing slash in icon path --- Classes/Domain/Repository/BackendLayoutRepository.php | 6 +++--- .../Imaging/IconProvider/ContentElementIconProvider.php | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Classes/Domain/Repository/BackendLayoutRepository.php b/Classes/Domain/Repository/BackendLayoutRepository.php index 53b8cd24..10a0923c 100644 --- a/Classes/Domain/Repository/BackendLayoutRepository.php +++ b/Classes/Domain/Repository/BackendLayoutRepository.php @@ -43,7 +43,7 @@ class BackendLayoutRepository extends \TYPO3\CMS\Extbase\Persistence\Repository { /** - * @var MASK\Mask\Backend\BackendLayoutView + * @var \MASK\Mask\Backend\BackendLayoutView */ protected $backendLayoutView; @@ -75,10 +75,10 @@ public function findAll($pageTsPids = array()) $pageTsConfig = (array)\TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($pid); $dataProviderContext = $this->backendLayoutView->createDataProviderContext()->setPageTsConfig($pageTsConfig); $backendLayoutCollections = $this->backendLayoutView->getDataProviderCollection()->getBackendLayoutCollections($dataProviderContext); - foreach ($backendLayoutCollections["default"]->getAll() as $backendLayout) { + foreach ($backendLayoutCollections['default']->getAll() as $backendLayout) { $backendLayouts[$backendLayout->getIdentifier()] = $backendLayout; } - foreach ($backendLayoutCollections["pagets"]->getAll() as $backendLayout) { + foreach ($backendLayoutCollections['pagets']->getAll() as $backendLayout) { $backendLayouts[$backendLayout->getIdentifier()] = $backendLayout; } } diff --git a/Classes/Imaging/IconProvider/ContentElementIconProvider.php b/Classes/Imaging/IconProvider/ContentElementIconProvider.php index 1904bc16..983f9296 100644 --- a/Classes/Imaging/IconProvider/ContentElementIconProvider.php +++ b/Classes/Imaging/IconProvider/ContentElementIconProvider.php @@ -2,9 +2,9 @@ namespace MASK\Mask\Imaging\IconProvider; -use TYPO3\CMS\Core\Core\Environment; use TYPO3\CMS\Core\Imaging\Icon; use TYPO3\CMS\Core\Imaging\IconProviderInterface; +use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\PathUtility; /* * ************************************************************* @@ -141,8 +141,7 @@ protected function generateMarkup(Icon $icon, array $options) */ protected function isPreviewIconAvailable($key) { - $pathSite = Environment::getPublicPath(); - return file_exists($pathSite . $this->getPreviewIconPath($key)); + return file_exists($this->getPreviewIconPath($key)); } /** @@ -158,13 +157,15 @@ protected function isFontAwesomeKeyAvailable($element) } /** + * Returns public path of icon + * * @param string $key * @author Benjamin Butschell * @return string */ protected function getPreviewIconPath($key) { - return $this->extSettings['preview'] . $key . '.png'; + return GeneralUtility::getFileAbsFileName($this->extSettings['preview'] . $key . '.png'); } /** From 4c369d6b6230dbeb5c69cced1743fd1132776a2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Venne?= Date: Mon, 13 Jan 2020 14:37:51 +0100 Subject: [PATCH 15/93] [TASK] xclass class FluidTemplateContentObject see: https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/9.5/Deprecation-86270-ExtbaseXclassViaTypoScriptSettings.html --- Configuration/TypoScript/page.txt | 5 ----- ext_localconf.php | 3 ++- 2 files changed, 2 insertions(+), 6 deletions(-) delete mode 100644 Configuration/TypoScript/page.txt diff --git a/Configuration/TypoScript/page.txt b/Configuration/TypoScript/page.txt deleted file mode 100644 index 6a140f2b..00000000 --- a/Configuration/TypoScript/page.txt +++ /dev/null @@ -1,5 +0,0 @@ -config.tx_extbase { - objects { - TYPO3\CMS\Frontend\ContentObject\FluidTemplateContentObject.className = MASK\Mask\Fluid\FluidTemplateContentObject - } -} \ No newline at end of file diff --git a/ext_localconf.php b/ext_localconf.php index 3bc01a71..a3387460 100755 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -37,8 +37,9 @@ )); } + $GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][TYPO3\CMS\Frontend\ContentObject\FluidTemplateContentObject::class] = \MASK\Mask\Fluid\FluidTemplateContentObject::class; + // TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\Container\Container::class)->registerImplementation(TYPO3\CMS\Frontend\ContentObject\FluidTemplateContentObject::class, \MASK\Mask\Fluid\FluidTemplateContentObject::class); // Add all the typoscript we need in the correct files - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(''); $tsConfig = $typoScriptCodeGenerator->generateTsConfig($configuration); $pageTs = $typoScriptCodeGenerator->generatePageTyposcript($configuration); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig($tsConfig); From 45706c09eaa0596660308e6cf445e6ec63722728 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Venne?= Date: Tue, 14 Jan 2020 09:30:31 +0100 Subject: [PATCH 16/93] Revert "[BUGFIX] dirty fix missing table error" This reverts commit 0b8e739ffe24550e6a3fd285203ae3a2f43518ee. --- ext_tables.sql | 41 ----------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 ext_tables.sql diff --git a/ext_tables.sql b/ext_tables.sql deleted file mode 100644 index e1fceb90..00000000 --- a/ext_tables.sql +++ /dev/null @@ -1,41 +0,0 @@ -# -# Table structure for table 'tx_mask_domain_model_backendlayout' -# -CREATE TABLE tx_mask_domain_model_backendlayout -( - uid int(11) NOT NULL auto_increment, - pid int(11) DEFAULT '0' NOT NULL, - - tstamp int(11) unsigned DEFAULT '0' NOT NULL, - crdate int(11) unsigned DEFAULT '0' NOT NULL, - cruser_id int(11) unsigned DEFAULT '0' NOT NULL, - deleted SMALLINT unsigned DEFAULT '0' NOT NULL, - hidden SMALLINT unsigned DEFAULT '0' NOT NULL, - starttime int(11) unsigned DEFAULT '0' NOT NULL, - endtime int(11) unsigned DEFAULT '0' NOT NULL, - - t3ver_oid int(11) DEFAULT '0' NOT NULL, - t3ver_id int(11) DEFAULT '0' NOT NULL, - t3ver_wsid int(11) DEFAULT '0' NOT NULL, - t3ver_label varchar(255) DEFAULT '' NOT NULL, - t3ver_state SMALLINT DEFAULT '0' NOT NULL, - t3ver_stage int(11) DEFAULT '0' NOT NULL, - t3ver_count int(11) DEFAULT '0' NOT NULL, - t3ver_tstamp int(11) DEFAULT '0' NOT NULL, - t3ver_move_id int(11) DEFAULT '0' NOT NULL, - - sys_language_uid int(11) DEFAULT '0' NOT NULL, - l10n_parent int(11) DEFAULT '0' NOT NULL, - l10n_diffsource mediumblob, - l10n_state text, - - PRIMARY KEY (uid), - KEY parent (pid), - KEY t3ver_oid (t3ver_oid, t3ver_wsid), - KEY language (l10n_parent, sys_language_uid), - - parentid int(11) DEFAULT '0' NOT NULL, - parenttable varchar(255) DEFAULT '', - sorting int(11) DEFAULT '0' NOT NULL - -); From f058fa39365dfdfd348f22a29716ef9049e1c974 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Venne?= Date: Tue, 14 Jan 2020 09:36:29 +0100 Subject: [PATCH 17/93] [TASK] map extbase classes to TYPO3s tables --- Classes/CodeGenerator/SqlCodeGenerator.php | 16 ++++---- .../CodeGenerator/TyposcriptCodeGenerator.php | 13 ------- .../Domain/Repository/ContentRepository.php | 4 +- Configuration/Extbase/Persistence/Classes.php | 37 +++++++++++++++++++ ext_typoscript_setup.txt | 21 ----------- 5 files changed, 47 insertions(+), 44 deletions(-) create mode 100644 Configuration/Extbase/Persistence/Classes.php diff --git a/Classes/CodeGenerator/SqlCodeGenerator.php b/Classes/CodeGenerator/SqlCodeGenerator.php index 5100f096..f9697c49 100644 --- a/Classes/CodeGenerator/SqlCodeGenerator.php +++ b/Classes/CodeGenerator/SqlCodeGenerator.php @@ -73,14 +73,14 @@ protected function performDbUpdates(array $sqlStatements) $connection->exec($statement); } catch (DBALException $exception) { $hasErrors = true; - GeneralUtility::devlog( - 'SQL error', - 'mask', - 0, - [ - 'statement' => $statement, - 'error' => $exception->getMessage() - ]); + // GeneralUtility::devlog( + // 'SQL error', + // 'mask', + // 0, + // [ + // 'statement' => $statement, + // 'error' => $exception->getMessage() + // ]); } } } diff --git a/Classes/CodeGenerator/TyposcriptCodeGenerator.php b/Classes/CodeGenerator/TyposcriptCodeGenerator.php index c80240a8..d500c9f2 100644 --- a/Classes/CodeGenerator/TyposcriptCodeGenerator.php +++ b/Classes/CodeGenerator/TyposcriptCodeGenerator.php @@ -156,19 +156,6 @@ public function generateSetupTyposcript($configuration, $settings) 10 => 'EXT:mask/Resources/Private/Backend/Layouts/' ] ], - 'persistence' => [ - 'classes' => [ - BackendLayout::class => [ - 'mapping' => [ - 'tableName' => 'backend_layout', - 'columns' => [ - 'uid.mapOnProperty' => 'uid', - 'title.mapOnProperty' => 'title' - ] - ] - ] - ] - ] ], 'module.tx_mask'); // for base paths to fluid templates configured in extension settings diff --git a/Classes/Domain/Repository/ContentRepository.php b/Classes/Domain/Repository/ContentRepository.php index 472b3fca..f58b6057 100644 --- a/Classes/Domain/Repository/ContentRepository.php +++ b/Classes/Domain/Repository/ContentRepository.php @@ -38,8 +38,8 @@ class ContentRepository extends \TYPO3\CMS\Extbase\Persistence\Repository public function initializeObject() { - /** @var $querySettings TYPO3CMSExtbasePersistenceGenericTypo3QuerySettings */ - $querySettings = $this->objectManager->get('TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings'); + /** @var $querySettings \TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings */ + $querySettings = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings::class); $querySettings->setRespectStoragePage(false); $querySettings->setIgnoreEnableFields(false); $querySettings->setIncludeDeleted(false); diff --git a/Configuration/Extbase/Persistence/Classes.php b/Configuration/Extbase/Persistence/Classes.php new file mode 100644 index 00000000..05c47d8d --- /dev/null +++ b/Configuration/Extbase/Persistence/Classes.php @@ -0,0 +1,37 @@ + [ + 'tableName' => 'tt_content', + 'properties' => [ + 'uid' => [ + 'fieldName' => 'uid' + ], + 'pid' => [ + 'fieldName' => 'pid' + ], + 'sorting' => [ + 'fieldName' => 'sorting' + ], + 'contentType' => [ + 'fieldName' => 'CType' + ], + 'header' => [ + 'fieldName' => 'header' + ] + ], + ], + + MASK\Mask\Domain\Model\BackendLayout::class => [ + 'tableName' => 'backend_layout', + 'properties' => [ + 'uid' => [ + 'fieldname' => 'uid' + ], + 'title' => [ + 'fieldname' => 'title' + ] + ] + ] +]; diff --git a/ext_typoscript_setup.txt b/ext_typoscript_setup.txt index 37ecc00f..81a3a18e 100644 --- a/ext_typoscript_setup.txt +++ b/ext_typoscript_setup.txt @@ -13,24 +13,3 @@ module.tx_mask { layoutRootPaths.0 = EXT:mask/Resources/Private/Backend/Layouts/ } } - -config.tx_extbase { - persistence { - enableAutomaticCacheClearing = 1 - updateReferenceIndex = 0 - classes { - MASK\Mask\Domain\Model\Content { - mapping { - tableName = tt_content - columns { - uid.mapOnProperty = uid - pid.mapOnProperty = pid - sorting.mapOnProperty = sorting - CType.mapOnProperty = contentType - header.mapOnProperty = header - } - } - } - } - } -} From eac0fa22869fe5e18c39779b4ad7f0a2ff5d1d0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Venne?= Date: Tue, 14 Jan 2020 09:37:02 +0100 Subject: [PATCH 18/93] [TASK] use correct validator classes --- Classes/Domain/Model/Content.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Classes/Domain/Model/Content.php b/Classes/Domain/Model/Content.php index 85df4a4e..f04af113 100644 --- a/Classes/Domain/Model/Content.php +++ b/Classes/Domain/Model/Content.php @@ -42,7 +42,7 @@ class Content extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity * Title for the New-Contentelement-Wizard. * * @var string - * @Validate("notEmpty") + * @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty") */ protected $title; @@ -64,7 +64,7 @@ class Content extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity * Lowercase internal Key. Not Visible in TYPO3 Backend. * * @var string - * @Validate("NotEmpty") + * @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty") */ protected $fieldkey; @@ -72,7 +72,7 @@ class Content extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity * contentType * * @var string - * @Validate("NotEmpty") + * @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty") */ protected $contentType; From a91253dea76e970f10651b61ccb4682429dd4498 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Venne?= Date: Tue, 14 Jan 2020 09:38:28 +0100 Subject: [PATCH 19/93] [TASK] drop support of TYPO3 9.5, require TYPO3 10.3 --- ext_emconf.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ext_emconf.php b/ext_emconf.php index 3742f488..df22f30d 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -19,9 +19,9 @@ 'version' => '4.1.2', 'constraints' => [ 'depends' => [ - 'typo3' => '9.3.0-9.5.99', - 'extbase' => '9.3.0-9.5.99', - 'fluid' => '9.3.0-9.5.99', + 'typo3' => '10.3.0-10.4.99', + 'extbase' => '10.3.0-10.4.99', + 'fluid' => '10.3.0-10.4.99', ], 'conflicts' => [], 'suggests' => [ From ef0ce237c74d0e96a219a94719bf93a0a7b5cc50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Venne?= Date: Tue, 14 Jan 2020 16:40:18 +0100 Subject: [PATCH 20/93] [TASK] move typoscript userfuncs to symfony expression providers --- .../CodeGenerator/TyposcriptCodeGenerator.php | 34 +++--- .../MaskFunctionsProvider.php | 111 ++++++++++++++++++ Classes/ExpressionLanguage/MaskProvider.php | 22 ++++ Configuration/ExpressionLanguage.php | 7 ++ ext_localconf.php | 107 +---------------- 5 files changed, 163 insertions(+), 118 deletions(-) create mode 100644 Classes/ExpressionLanguage/MaskFunctionsProvider.php create mode 100644 Classes/ExpressionLanguage/MaskProvider.php create mode 100644 Configuration/ExpressionLanguage.php diff --git a/Classes/CodeGenerator/TyposcriptCodeGenerator.php b/Classes/CodeGenerator/TyposcriptCodeGenerator.php index d500c9f2..9ed9d5d7 100644 --- a/Classes/CodeGenerator/TyposcriptCodeGenerator.php +++ b/Classes/CodeGenerator/TyposcriptCodeGenerator.php @@ -48,42 +48,44 @@ class TyposcriptCodeGenerator extends AbstractCodeGenerator public function generateTsConfig($json) { // generate page TSconfig - $content = ""; - $iconRegistry = GeneralUtility::makeInstance("TYPO3\CMS\Core\Imaging\IconRegistry"); + $content = ''; + $iconRegistry = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class); // make content-Elements - if ($json["tt_content"]["elements"]) { - foreach ($json["tt_content"]["elements"] as $element) { + if ($json['tt_content']['elements']) { + foreach ($json['tt_content']['elements'] as $element) { // Register icons for contentelements - $iconIdentifier = 'mask-ce-' . $element["key"]; + $iconIdentifier = 'mask-ce-' . $element['key']; $iconRegistry->registerIcon( - $iconIdentifier, "MASK\Mask\Imaging\IconProvider\ContentElementIconProvider", array( - 'contentElementKey' => $element["key"] + $iconIdentifier, \MASK\Mask\Imaging\IconProvider\ContentElementIconProvider::class, array( + 'contentElementKey' => $element['key'] ) ); - if (!$element["hidden"]) { + if (!$element['hidden']) { // add the content element wizard for each content element $wizard = [ 'header' => 'LLL:EXT:mask/Resources/Private/Language/locallang_mask.xlf:new_content_element_tab', - 'elements.mask_' . $element["key"] => [ + 'elements.mask_' . $element['key'] => [ 'iconIdentifier' => $iconIdentifier, - 'title' => $element["label"], - 'description' => $element["description"], + 'title' => $element['label'], + 'description' => $element['description'], 'tt_content_defValues' => [ - 'CType' => 'mask_' . $element["key"] + 'CType' => 'mask_' . $element['key'] ] ], ]; $content .= "mod.wizards.newContentElement.wizardItems.mask {\n"; $content .= $this->convertArrayToTypoScript($wizard, '', 1); - $content .= "\tshow := addToList(mask_" . $element["key"] . ");\n"; + $content .= "\tshow := addToList(mask_" . $element['key'] . ");\n"; $content .= "}\n"; // and switch the labels depending on which content element is selected - $content .= "\n[userFunc = user_mask_contentType(CType|mask_" . $element["key"] . ")]\n"; + // $content .= "\n[userFunc = user_mask_contentType(CType|mask_" . $element["key"] . ")]\n"; + + $content .= "\n[maskContentType(\"CType|mask_" . $element["key"] . "\")]\n"; if ($element["columns"]) { foreach ($element["columns"] as $index => $column) { $content .= " TCEFORM.tt_content." . $column . ".label = " . $element["labels"][$index] . "\n"; @@ -109,7 +111,7 @@ public function generatePageTyposcript($json) if ($json["pages"]["elements"]) { foreach ($json["pages"]["elements"] as $element) { // Labels for pages - $pagesContent .= "\n[userFunc = user_mask_beLayout(" . $element["key"] . ")]\n"; + // todo: debug $pagesContent .= "\n[maskBeLayout(\"" . $element["key"] . "\")]\n"; // if page has backendlayout with this element-key if ($element["columns"]) { foreach ($element["columns"] as $index => $column) { @@ -121,7 +123,7 @@ public function generatePageTyposcript($json) $pagesContent .= " TCEFORM.pages." . $column . ".disabled = 0\n"; } } - $pagesContent .= "[end]\n"; + // todo: debug $pagesContent .= "[end]\n"; } } // disable all fields by default and only activate by condition diff --git a/Classes/ExpressionLanguage/MaskFunctionsProvider.php b/Classes/ExpressionLanguage/MaskFunctionsProvider.php new file mode 100644 index 00000000..60d9c109 --- /dev/null +++ b/Classes/ExpressionLanguage/MaskFunctionsProvider.php @@ -0,0 +1,111 @@ +maskBeLayout(), + $this->maskContentType(), + ]; + } + + protected function maskBeLayout(): ExpressionFunction + { + return new ExpressionFunction('maskBeLayout', function ($param) { + // Not implemented, we only use the evaluator + }, function ($arguments, $param = null) { + $layout = $param; + // get current page uid: + if (is_array($_REQUEST['data']['pages'])) { // after saving page + $uid = (int)key($_REQUEST['data']['pages']); + } elseif ($GLOBALS['SOBE']->editconf['pages']) { // after opening pages + $uid = (int)key($GLOBALS['SOBE']->editconf['pages']); + } else { + if ($GLOBALS['_SERVER']['HTTP_REFERER'] !== '') { + $url = $GLOBALS['_SERVER']['HTTP_REFERER']; + $queryString = parse_url($url, PHP_URL_QUERY); + $result = array(); + parse_str($queryString, $result); + if ($result['id']) { + $uid = (int)$result['id']; + } + } + } + + if ($uid) { + /** @var \TYPO3\CMS\Core\Database\Connection $connection */ + $connection = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\ConnectionPool::class)->getConnectionForTable('pages'); + $query = $connection->createQueryBuilder(); + /** @var \TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction $deletedRestriction */ + $deletedRestriction = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction::class); + $query->getRestrictions()->removeAll()->add($deletedRestriction); + $data = $query->select('backend_layout', 'backend_layout_next_level')->from('pages')->where($query->expr()->eq('uid', $uid))->execute() + ->fetch(\Doctrine\DBAL\FetchMode::ASSOCIATIVE); + + $backend_layout = $data['backend_layout']; + $backend_layout_next_level = $data['backend_layout_next_level']; + + if ($backend_layout !== '') { // If backend_layout is set on current page + return in_array($backend_layout, [$layout, 'pagets__' . $layout]); + } + + if ($backend_layout_next_level !== '') { // If backend_layout_next_level is set on current page + return in_array($backend_layout_next_level, [$layout, 'pagets__' . $layout]); + } + + // If backend_layout and backend_layout_next_level is not set on current page, check backend_layout_next_level on rootline + $sysPage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Domain\Repository\PageRepository::class); + try { + $rootline = $sysPage->getRootLine($uid, ''); + } catch (\Exception $e) { + $rootline = []; + } + foreach ($rootline as $page) { + if (in_array($page['backend_layout_next_level'], [$layout, 'pagets__' . $layout])) { + return true; + } + } + } + return false; + }); + } + + protected function maskContentType(): ExpressionFunction + { + return new ExpressionFunction('maskContentType', function ($param) { + // Not implemented, we only use the evaluator + }, function ($arguments, $param) { + static $cTypeCache = []; + if (isset($_REQUEST['edit']['tt_content']) && is_array($_REQUEST['edit']['tt_content'])) { + $field = explode('|', $param); + $request = $_REQUEST; + $first = array_shift($request['edit']['tt_content']); + + if ($first === 'new') { // if new element + return $_REQUEST['defVals']['tt_content']['CType'] === $field[1]; + } + // if element exists + $uid = (int)key($_REQUEST['edit']['tt_content']); + + if (!isset($cTypeCache[$uid])) { + /** @var \TYPO3\CMS\Core\Database\ConnectionPool $connection */ + $connection = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\ConnectionPool::class); + $queryBuilder = $connection->getQueryBuilderForTable('tt_content'); + /** @var \TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction $deletedRestriction */ + $deletedRestriction = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction::class); + $queryBuilder->getRestrictions()->removeAll()->add($deletedRestriction); + $cTypeCache[$uid] = $queryBuilder->select($field[0])->from('tt_content')->where($queryBuilder->expr()->eq('uid', $uid))->execute()->fetchColumn(0); + } + return $cTypeCache[$uid] == $field[1]; + } + // if content element is loaded by ajax, then it's ok + return is_array($_REQUEST['ajax']); + }); + } +} diff --git a/Classes/ExpressionLanguage/MaskProvider.php b/Classes/ExpressionLanguage/MaskProvider.php new file mode 100644 index 00000000..315cc2fa --- /dev/null +++ b/Classes/ExpressionLanguage/MaskProvider.php @@ -0,0 +1,22 @@ +expressionLanguageVariables = [ + // 'foo' => 1, + // 'bar' => 2, + ]; + $this->expressionLanguageProviders = [ + // We use the existing Typo3ConditionsFunctions... + Typo3ConditionFunctionsProvider::class, + // ... and our custom function provider + MaskFunctionsProvider::class + ]; + } +} diff --git a/Configuration/ExpressionLanguage.php b/Configuration/ExpressionLanguage.php new file mode 100644 index 00000000..43dfe8da --- /dev/null +++ b/Configuration/ExpressionLanguage.php @@ -0,0 +1,7 @@ + [ + \MASK\Mask\ExpressionLanguage\MaskProvider::class, + ] +]; diff --git a/ext_localconf.php b/ext_localconf.php index a3387460..e6b2cc8e 100755 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -32,13 +32,11 @@ 'Content' ]; foreach ($maskIcons as $maskIcon) { - $iconRegistry->registerIcon('mask-fieldtype-' . $maskIcon, 'TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider', array( + $iconRegistry->registerIcon('mask-fieldtype-' . $maskIcon, TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, [ 'source' => 'EXT:mask/Resources/Public/Icons/Fieldtypes/' . $maskIcon . '.svg' - )); + ]); } - $GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][TYPO3\CMS\Frontend\ContentObject\FluidTemplateContentObject::class] = \MASK\Mask\Fluid\FluidTemplateContentObject::class; - // TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\Container\Container::class)->registerImplementation(TYPO3\CMS\Frontend\ContentObject\FluidTemplateContentObject::class, \MASK\Mask\Fluid\FluidTemplateContentObject::class); // Add all the typoscript we need in the correct files $tsConfig = $typoScriptCodeGenerator->generateTsConfig($configuration); $pageTs = $typoScriptCodeGenerator->generatePageTyposcript($configuration); @@ -47,102 +45,7 @@ $setupTs = $typoScriptCodeGenerator->generateSetupTyposcript($configuration, $settings); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptSetup($setupTs); - - // for conditions on tt_content - if (!function_exists('user_mask_contentType')) { - - function user_mask_contentType($param = '') - { - static $cTypeCache = []; - - if (isset($_REQUEST['edit']['tt_content']) && is_array($_REQUEST['edit']['tt_content'])) { - $field = explode('|', $param); - $request = $_REQUEST; - $first = array_shift($request['edit']['tt_content']); - - if ($first === 'new') { // if new element - return $_REQUEST['defVals']['tt_content']['CType'] === $field[1]; - } - // if element exists - $uid = (int)key($_REQUEST['edit']['tt_content']); - - if (!isset($cTypeCache[$uid])) { - /** @var \TYPO3\CMS\Core\Database\ConnectionPool $connection */ - $connection = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\ConnectionPool::class); - $queryBuilder = $connection->getQueryBuilderForTable('tt_content'); - /** @var \TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction $deletedRestriction */ - $deletedRestriction = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction::class); - $queryBuilder->getRestrictions()->removeAll()->add($deletedRestriction); - $cTypeCache[$uid] = $queryBuilder->select($field[0])->from('tt_content')->where($queryBuilder->expr()->eq('uid', $uid))->execute()->fetchColumn(0); - } - - return $cTypeCache[$uid] == $field[1]; - } - // if content element is loaded by ajax, then it's ok - return is_array($_REQUEST['ajax']); - } - } - - // for conditions on the backend-layouts - if (!function_exists('user_mask_beLayout')) { - - function user_mask_beLayout($layout = null) - { - // get current page uid: - if (is_array($_REQUEST['data']['pages'])) { // after saving page - $uid = (int) key($_REQUEST['data']['pages']); - } elseif ($GLOBALS['SOBE']->editconf['pages']) { // after opening pages - $uid = (int) key($GLOBALS['SOBE']->editconf['pages']); - } else { - if ($GLOBALS['_SERVER']['HTTP_REFERER'] !== '') { - $url = $GLOBALS['_SERVER']['HTTP_REFERER']; - $queryString = parse_url($url, PHP_URL_QUERY); - $result = array(); - parse_str($queryString, $result); - if ($result['id']) { - $uid = (int)$result['id']; - } - } - } - - if ($uid) { - /** @var \TYPO3\CMS\Core\Database\Connection $connection */ - $connection = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\ConnectionPool::class)->getConnectionForTable('pages'); - $query = $connection->createQueryBuilder(); - /** @var \TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction $deletedRestriction */ - $deletedRestriction = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction::class); - $query->getRestrictions()->removeAll()->add($deletedRestriction); - $data = $query->select('backend_layout', 'backend_layout_next_level')->from('pages')->where($query->expr()->eq('uid', $uid))->execute() - ->fetch(\Doctrine\DBAL\FetchMode::ASSOCIATIVE); - - $backend_layout = $data['backend_layout']; - $backend_layout_next_level = $data['backend_layout_next_level']; - - if ($backend_layout !== '') { // If backend_layout is set on current page - return in_array($backend_layout, [$layout, 'pagets__' . $layout]); - } - - if ($backend_layout_next_level !== '') { // If backend_layout_next_level is set on current page - return in_array($backend_layout_next_level, [$layout, 'pagets__' . $layout]); - } - - // If backend_layout and backend_layout_next_level is not set on current page, check backend_layout_next_level on rootline - $sysPage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(TYPO3\CMS\Core\Domain\Repository\PageRepository::class); - try { - $rootline = $sysPage->getRootLine($uid, ''); - } catch (Exception $e) { - $rootline = []; - } - foreach ($rootline as $page) { - if (in_array($page['backend_layout_next_level'], [$layout, 'pagets__' . $layout])) { - return true; - } - } - } - return false; - } - } - + // set root line fields if ($json['pages']['tca']) { $rootlineFields = explode(',', $GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields']); @@ -162,9 +65,9 @@ function user_mask_beLayout($layout = null) 'addDatabaseTablesDefinition'); // Enhance Fluid Output with overridden FluidTemplateContentObject - $GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][TYPO3\CMS\Frontend\ContentObject\FluidTemplateContentObject::class] = array( + $GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][TYPO3\CMS\Frontend\ContentObject\FluidTemplateContentObject::class] = [ 'className' => MASK\Mask\Fluid\FluidTemplateContentObject::class - ); + ]; // Hook to override tt_content backend_preview $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem'][$extkey] = \MASK\Mask\Hooks\PageLayoutViewDrawItem::class; From cca6ed4178ddd155f8afe83b94190c732d3b848e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Venne?= Date: Tue, 14 Jan 2020 16:41:41 +0100 Subject: [PATCH 21/93] [TASK] minor code improvements --- Classes/DataProcessing/MaskProcessor.php | 1 + Classes/Fluid/FluidTemplateContentObject.php | 4 ++-- Classes/Hooks/PageLayoutViewDrawItem.php | 6 +++--- Configuration/TCA/Overrides/tt_content.php | 2 +- ext_localconf.php | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Classes/DataProcessing/MaskProcessor.php b/Classes/DataProcessing/MaskProcessor.php index e5b3fad5..5452150b 100644 --- a/Classes/DataProcessing/MaskProcessor.php +++ b/Classes/DataProcessing/MaskProcessor.php @@ -4,6 +4,7 @@ use MASK\Mask\Helper\InlineHelper; use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Extbase\Annotation\Inject; use TYPO3\CMS\Extbase\Object\ObjectManager; use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; use TYPO3\CMS\Frontend\ContentObject\DataProcessorInterface; diff --git a/Classes/Fluid/FluidTemplateContentObject.php b/Classes/Fluid/FluidTemplateContentObject.php index 246dd845..d5153775 100755 --- a/Classes/Fluid/FluidTemplateContentObject.php +++ b/Classes/Fluid/FluidTemplateContentObject.php @@ -71,8 +71,8 @@ protected function getContentObjectVariables(array $conf = array()) // Make some enhancements to data $data = $variables['data']; - $this->inlineHelper->addFilesToData($data, "pages"); - $this->inlineHelper->addIrreToData($data, "pages"); + $this->inlineHelper->addFilesToData($data, 'pages'); + $this->inlineHelper->addIrreToData($data, 'pages'); $variables['data'] = $data; return $variables; diff --git a/Classes/Hooks/PageLayoutViewDrawItem.php b/Classes/Hooks/PageLayoutViewDrawItem.php index 2e26bf9a..6ae3e2e1 100644 --- a/Classes/Hooks/PageLayoutViewDrawItem.php +++ b/Classes/Hooks/PageLayoutViewDrawItem.php @@ -99,7 +99,7 @@ public function preProcess( $this->extSettings = $this->settingsService->get(); // only render special backend preview if it is a mask element - if (substr($row['CType'], 0, 4) === "mask") { + if (strpos($row['CType'], 'mask') === 0) { $elementKey = substr($row['CType'], 5); # fallback to prevent breaking change @@ -123,11 +123,11 @@ public function preProcess( // if there are paths for layouts and partials set, add them to view if (!empty($this->extSettings["layouts_backend"])) { $layoutRootPath = MaskUtility::getFileAbsFileName($this->extSettings["layouts_backend"]); - $view->setLayoutRootPaths(array($layoutRootPath)); + $view->setLayoutRootPaths([$layoutRootPath]); } if (!empty($this->extSettings["partials_backend"])) { $partialRootPath = MaskUtility::getFileAbsFileName($this->extSettings["partials_backend"]); - $view->setPartialRootPaths(array($partialRootPath)); + $view->setPartialRootPaths([$partialRootPath]); } // Fetch and assign some useful variables diff --git a/Configuration/TCA/Overrides/tt_content.php b/Configuration/TCA/Overrides/tt_content.php index 32c1c821..6e3c5d3c 100644 --- a/Configuration/TCA/Overrides/tt_content.php +++ b/Configuration/TCA/Overrides/tt_content.php @@ -9,7 +9,7 @@ } // and set mask itemsProcFuncs $GLOBALS['TCA']['tt_content']['columns']['colPos']['config']['itemsProcFunc'] = 'MASK\Mask\ItemsProcFuncs\ColPosList->itemsProcFunc'; -$GLOBALS['TCA']['tt_content']['columns']['CType']['config']['itemsProcFunc'] = 'MASK\Mask\ItemsProcFuncs\CTypeList->itemsProcFunc'; +$GLOBALS['TCA']['tt_content']['columns']['CType']['config']['itemsProcFunc'] = MASK\Mask\ItemsProcFuncs\CTypeList::class . '->itemsProcFunc'; $storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Domain\\Repository\\StorageRepository'); $configuration = $storageRepository->load(); diff --git a/ext_localconf.php b/ext_localconf.php index e6b2cc8e..2d70d497 100755 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -45,7 +45,7 @@ $setupTs = $typoScriptCodeGenerator->generateSetupTyposcript($configuration, $settings); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptSetup($setupTs); - + // set root line fields if ($json['pages']['tca']) { $rootlineFields = explode(',', $GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields']); From dd3cdd0ada1b3a759286fcd16eef839da830f680 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Venne?= Date: Tue, 14 Jan 2020 16:42:41 +0100 Subject: [PATCH 22/93] [TASK] move module and plugin view configuration to setup.txt --- Configuration/TypoScript/setup.txt | 19 ++++++++++++++++++- ext_typoscript_setup.txt | 15 --------------- 2 files changed, 18 insertions(+), 16 deletions(-) delete mode 100644 ext_typoscript_setup.txt diff --git a/Configuration/TypoScript/setup.txt b/Configuration/TypoScript/setup.txt index 25caecf6..3ebdd531 100644 --- a/Configuration/TypoScript/setup.txt +++ b/Configuration/TypoScript/setup.txt @@ -1,3 +1,19 @@ +plugin.tx_mask { + view { + templateRootPaths.0 = EXT:mask/Resources/Private/Templates/ + partialRootPaths.0 = EXT:mask/Resources/Private/Partials/ + layoutRootPaths.0 = EXT:mask/Resources/Private/Layouts/ + } +} + +module.tx_mask { + view { + templateRootPaths.0 = EXT:mask/Resources/Private/Backend/Templates/ + partialRootPaths.0 = EXT:mask/Resources/Private/Backend/Partials/ + layoutRootPaths.0 = EXT:mask/Resources/Private/Backend/Layouts/ + } +} + # snippet to render content elements lib.tx_mask.content = RECORDS lib.tx_mask.content { @@ -27,7 +43,8 @@ temp.mask.page { key.override.field = backend_layout default = TEXT - default.value = fileadmin/templates/default.html +# default.value = fileadmin/templates/default.html + default.value = typo3conf/ext/mask/Resources/Private/Backend/Layouts/Default.html } } diff --git a/ext_typoscript_setup.txt b/ext_typoscript_setup.txt deleted file mode 100644 index 81a3a18e..00000000 --- a/ext_typoscript_setup.txt +++ /dev/null @@ -1,15 +0,0 @@ -plugin.tx_mask { - view { - templateRootPaths.0 = EXT:mask/Resources/Private/Templates/ - partialRootPaths.0 = EXT:mask/Resources/Private/Partials/ - layoutRootPaths.0 = EXT:mask/Resources/Private/Layouts/ - } -} - -module.tx_mask { - view { - templateRootPaths.0 = EXT:mask/Resources/Private/Backend/Templates/ - partialRootPaths.0 = EXT:mask/Resources/Private/Backend/Partials/ - layoutRootPaths.0 = EXT:mask/Resources/Private/Backend/Layouts/ - } -} From 53de984358c4ba962cc75d02dc2116d631d7970a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Venne?= Date: Tue, 14 Jan 2020 16:46:18 +0100 Subject: [PATCH 23/93] [TASK] rename typoscript file --- Configuration/TypoScript/{setup.txt => setup.typoscript} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Configuration/TypoScript/{setup.txt => setup.typoscript} (100%) diff --git a/Configuration/TypoScript/setup.txt b/Configuration/TypoScript/setup.typoscript similarity index 100% rename from Configuration/TypoScript/setup.txt rename to Configuration/TypoScript/setup.typoscript From 1e62547bb328128c1f27b6f42b95c2fdbd2b7921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Venne?= Date: Sat, 7 Mar 2020 11:18:41 +0100 Subject: [PATCH 24/93] [TASK] allow TYPO3 master branch --- composer.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 93fcfac4..bdba5c51 100644 --- a/composer.json +++ b/composer.json @@ -26,10 +26,10 @@ "require": { "php": "^7.2", "ext-json": "*", - "typo3/cms-core": "10.3.*@dev", - "typo3/cms-backend": "10.3.*@dev", - "typo3/cms-fluid": "10.3.*@dev", - "typo3/cms-extbase": "10.3.*@dev" + "typo3/cms-core": "10.3.*@dev || dev-master", + "typo3/cms-backend": "10.3.*@dev || dev-master", + "typo3/cms-fluid": "10.3.*@dev || dev-master", + "typo3/cms-extbase": "10.3.*@dev || dev-master" }, "replace": { "mask": "self.version", From a8ae569607d54e4ab77554fcb61de823eb75551a Mon Sep 17 00:00:00 2001 From: Oliver Gassner Date: Tue, 10 Mar 2020 12:09:58 +0100 Subject: [PATCH 25/93] Add softref-config to rte fields Mask-RTE-Fields are missing the softref-config. You get no warning for example if you delete a file that is linked inside an rte-field. --- Classes/CodeGenerator/TcaCodeGenerator.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Classes/CodeGenerator/TcaCodeGenerator.php b/Classes/CodeGenerator/TcaCodeGenerator.php index b8da61b1..b5d1d02a 100644 --- a/Classes/CodeGenerator/TcaCodeGenerator.php +++ b/Classes/CodeGenerator/TcaCodeGenerator.php @@ -294,6 +294,10 @@ public function generateFieldsTca($tca) \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($columns[$tcakey], $tcavalue); } + + if (isset($columns[$tcakey]['rte'])){ + $columns[$tcakey]['config']['softref'] = 'rtehtmlarea_images,typolink_tag,images,email[subst],url'; + } // Unset some values that are not needed in TCA unset($columns[$tcakey]["options"]); From 232abc63ef70689f3349e883a0e8dcf90f700710 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Thu, 12 Mar 2020 16:42:32 +0100 Subject: [PATCH 26/93] [TASK] upgrade composer dependencies --- composer.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 94aa22ee..64f22d85 100644 --- a/composer.json +++ b/composer.json @@ -26,10 +26,10 @@ "require": { "php": "^7.2", "ext-json": "*", - "typo3/cms-core": "^9.5", - "typo3/cms-backend": "^9.5", - "typo3/cms-fluid": "^9.5", - "typo3/cms-extbase": "^9.5" + "typo3/cms-core": "^10.3", + "typo3/cms-backend": "^10.3", + "typo3/cms-fluid": "^10.3", + "typo3/cms-extbase": "^10.3" }, "replace": { "mask": "self.version", From 088c719ab0c9b9bce81ba06fa8591717b43dc488 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Thu, 12 Mar 2020 16:53:20 +0100 Subject: [PATCH 27/93] [TASK] replacing $_EXTKEY with extension key --- ext_localconf.php | 2 +- ext_tables.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ext_localconf.php b/ext_localconf.php index 6510c60a..6ce45486 100755 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -193,6 +193,6 @@ function user_mask_beLayout($layout = null) ); // Hook to override tt_content backend_preview -$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem'][$_EXTKEY] = \MASK\Mask\Hooks\PageLayoutViewDrawItem::class; +$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem']['mask'] = \MASK\Mask\Hooks\PageLayoutViewDrawItem::class; // Hook to override colpos check for unused tt_content elements $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['record_is_used'] [] = MASK\Mask\Hooks\PageLayoutViewHook::class . '->contentIsUsed'; diff --git a/ext_tables.php b/ext_tables.php index abbe0454..8acb500f 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -9,7 +9,7 @@ * Registers a Backend Module */ \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule( - 'MASK.' . $_EXTKEY, 'tools', // Make module a submodule of 'admin' + 'MASK.mask', 'tools', // Make module a submodule of 'admin' 'mask', // Submodule key 'top', // Position array( @@ -17,12 +17,12 @@ 'WizardPage' => 'list, new, create, edit, update, delete, showHtml', ), array( 'access' => 'admin', - 'icon' => 'EXT:' . $_EXTKEY . '/Resources/Public/Icons/module-mask_wizard.svg', - 'labels' => 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_mask.xlf', + 'icon' => 'EXT:mask/Resources/Public/Icons/module-mask_wizard.svg', + 'labels' => 'LLL:EXT:mask/Resources/Private/Language/locallang_mask.xlf', ) ); } -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile($_EXTKEY, 'Configuration/TypoScript', 'Mask'); +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile('mask', 'Configuration/TypoScript', 'Mask'); // include css for styling of backend preview of mask content elements $TBE_STYLES['skins']['mask']['name'] = 'mask'; From 4ef360dee72e48eaedb4f7189e27a1e0c3f58f0d Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Thu, 12 Mar 2020 16:58:55 +0100 Subject: [PATCH 28/93] [MERGE] Merge branch 'CDRO-master' into typo3-10, Migrate getRootline to RootlineUtility --- ext_localconf.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext_localconf.php b/ext_localconf.php index 6ce45486..147231d2 100755 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -152,7 +152,7 @@ function user_mask_beLayout($layout = null) } else { // If backend_layout and backend_layout_next_level is not set on current page, check backend_layout_next_level on rootline $sysPage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository'); try { - $rootline = $sysPage->getRootLine($uid, ''); + $rootline = (\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Utility\RootlineUtility::class, $uid))->get(); } catch (Exception $e) { $rootline = []; } From 489bed829d8dbdee70fe2fc7c9ba23ba48e43bb7 Mon Sep 17 00:00:00 2001 From: Patric Pesch Date: Tue, 5 Nov 2019 12:00:42 +0100 Subject: [PATCH 29/93] Fixed Issue #210 https://github.com/Gernott/mask/issues/210 --- Classes/Domain/Repository/StorageRepository.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/Domain/Repository/StorageRepository.php b/Classes/Domain/Repository/StorageRepository.php index 69ad6d38..693c8fbc 100644 --- a/Classes/Domain/Repository/StorageRepository.php +++ b/Classes/Domain/Repository/StorageRepository.php @@ -210,7 +210,7 @@ public function add($content) // If using a mask field with empty label, we have to set the "default" label $label = ''; foreach ($json[$content['type']]['elements'] as $element) { - if (in_array($content['elements']['columns'][$index], $element['columns'], true)) { + if (is_array($element['columns']) && in_array($content['elements']['columns'][$index], $element['columns'], true)) { $i = array_search($content['elements']['columns'][$index], $element['columns'], true); if (!empty($element['labels'][$i])) { $label = $element['labels'][$i]; From 3cfdee8da230623ab0bc2cabc74c651e987e6d39 Mon Sep 17 00:00:00 2001 From: pixelrausch Date: Thu, 30 Jan 2020 15:27:31 +0100 Subject: [PATCH 30/93] Makes hidden IRRE elements visible in the Backend --- Classes/Helper/InlineHelper.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Classes/Helper/InlineHelper.php b/Classes/Helper/InlineHelper.php index 61638193..5efddbb5 100644 --- a/Classes/Helper/InlineHelper.php +++ b/Classes/Helper/InlineHelper.php @@ -30,6 +30,7 @@ use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Annotation\Inject; +use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction; /** * Methods for working with inline fields (IRRE) @@ -233,6 +234,12 @@ public function getInlineElements( } $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($childTable); + if(TYPO3_MODE=='BE'){ + $queryBuilder + ->getRestrictions() + ->removeAll() + ->add(GeneralUtility::makeInstance(DeletedRestriction::class)); + } $queryBuilder ->select('*') ->from($childTable) From 0624238c6f532788ceae3e5c55efec9fe8a70105 Mon Sep 17 00:00:00 2001 From: pixelrausch Date: Thu, 30 Jan 2020 15:27:31 +0100 Subject: [PATCH 31/93] Makes hidden IRRE elements visible in the Backend --- Classes/Helper/InlineHelper.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Classes/Helper/InlineHelper.php b/Classes/Helper/InlineHelper.php index 61638193..5efddbb5 100644 --- a/Classes/Helper/InlineHelper.php +++ b/Classes/Helper/InlineHelper.php @@ -30,6 +30,7 @@ use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Annotation\Inject; +use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction; /** * Methods for working with inline fields (IRRE) @@ -233,6 +234,12 @@ public function getInlineElements( } $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($childTable); + if(TYPO3_MODE=='BE'){ + $queryBuilder + ->getRestrictions() + ->removeAll() + ->add(GeneralUtility::makeInstance(DeletedRestriction::class)); + } $queryBuilder ->select('*') ->from($childTable) From 3303223ba29915ae3110ac78852370b0384f5c6e Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Thu, 12 Mar 2020 17:18:35 +0100 Subject: [PATCH 32/93] [CLEANUP] formatting everything with .editorconfig --- .editorconfig | 7 +- Classes/CodeGenerator/SqlCodeGenerator.php | 2 +- Classes/CodeGenerator/TcaCodeGenerator.php | 14 ++- Classes/Controller/WizardController.php | 4 +- .../Domain/Repository/StorageRepository.php | 13 +-- Classes/Fluid/FluidTemplateContentObject.php | 2 +- Classes/Helper/InlineHelper.php | 2 +- .../ContentElementIconProvider.php | 12 +-- Classes/Utility/GeneralUtility.php | 2 +- Configuration/TypoScript/setup.txt | 2 +- Documentation/Settings.yml | 14 +-- .../Partials/Forms/Fields/Check/Tabs.html | 3 +- .../Partials/Forms/Fields/Date/Tabs.html | 2 +- .../Partials/Forms/Fields/Datetime/Tabs.html | 2 +- .../Partials/Forms/Fields/Float/Tabs.html | 3 +- .../Partials/Forms/Fields/Inline/Tabs.html | 2 +- .../Partials/Forms/Fields/Integer/Tabs.html | 3 +- .../Partials/Forms/Fields/Link/Tabs.html | 3 +- .../Partials/Forms/Fields/Radio/Tabs.html | 3 +- .../Partials/Forms/Fields/Richtext/Tabs.html | 3 +- .../Partials/Forms/Fields/Select/Tabs.html | 3 +- .../Partials/Forms/Fields/String/Tabs.html | 3 +- .../Partials/Forms/Fields/Text/Tabs.html | 3 +- .../Partials/Forms/Tabs/Tabheaders.html | 22 ++--- .../Backend/Partials/General/Tabs.html | 3 +- Resources/Private/Language/locallang.xlf | 3 +- Resources/Public/Icons/Extension.svg | 11 ++- Resources/Public/Icons/Fieldtypes/Date.svg | 85 ++++++++--------- Resources/Public/Icons/Fieldtypes/File.svg | 37 ++++---- Resources/Public/Icons/Fieldtypes/Float.svg | 94 ++++++++++--------- Resources/Public/Icons/Fieldtypes/Inline.svg | 16 ++-- Resources/Public/Icons/Fieldtypes/Integer.svg | 69 +++++++------- Resources/Public/Icons/Fieldtypes/Link.svg | 53 ++++++----- Resources/Public/Icons/Fieldtypes/Radio.svg | 21 +++-- .../Public/Icons/Fieldtypes/Richtext.svg | 43 ++++----- Resources/Public/Icons/Fieldtypes/Select.svg | 51 +++++----- Resources/Public/Icons/Fieldtypes/String.svg | 55 +++++------ Resources/Public/Icons/Fieldtypes/Tab.svg | 35 +++---- Resources/Public/Icons/Fieldtypes/Text.svg | 35 +++---- Resources/Public/Icons/module-mask_wizard.svg | 11 ++- Resources/Public/Images/github_logo.svg | 36 +++---- Resources/Public/Scripts/libs.js | 14 +-- Resources/Public/Scripts/scripts.js | 10 +- Resources/Public/Styles/styles.css | 6 +- ext_localconf.php | 3 +- 45 files changed, 431 insertions(+), 389 deletions(-) diff --git a/.editorconfig b/.editorconfig index 2671453c..761e909e 100644 --- a/.editorconfig +++ b/.editorconfig @@ -34,6 +34,7 @@ indent_size = 4 [*.ts] indent_style = space indent_size = 2 + [*.js] indent_style = space indent_size = 2 @@ -59,14 +60,14 @@ indent_style = space indent_size = 4 # YAML-Files -[{*.yaml,*.yml}] +[{*.yaml, *.yml}] indent_style = space indent_size = 2 # package.json # .travis.yml # bower.json -[{package.json,.travis.yml,bower.json}] +[{package.json, .travis.yml, bower.json}] indent_style = space indent_size = 2 @@ -74,9 +75,11 @@ indent_size = 2 [*.typoscript] indent_style = space indent_size = 2 + [*.ts] indent_style = space indent_size = 2 + [*.tsconfig] indent_style = space indent_size = 2 diff --git a/Classes/CodeGenerator/SqlCodeGenerator.php b/Classes/CodeGenerator/SqlCodeGenerator.php index 811dce2b..d74ade6e 100644 --- a/Classes/CodeGenerator/SqlCodeGenerator.php +++ b/Classes/CodeGenerator/SqlCodeGenerator.php @@ -97,8 +97,8 @@ protected function performDbUpdates(array $sqlStatements) /** * Updates the database if necessary * - * @author Benjamin Butschell * @return array + * @author Benjamin Butschell */ public function updateDatabase() { diff --git a/Classes/CodeGenerator/TcaCodeGenerator.php b/Classes/CodeGenerator/TcaCodeGenerator.php index 0c1a7e33..ffb331d7 100644 --- a/Classes/CodeGenerator/TcaCodeGenerator.php +++ b/Classes/CodeGenerator/TcaCodeGenerator.php @@ -34,8 +34,8 @@ class TcaCodeGenerator extends AbstractCodeGenerator /** * Generates and sets the correct tca for all the inline fields - * @author Benjamin Butschell * @param array $json + * @author Benjamin Butschell */ public function setInlineTca($json) { @@ -132,7 +132,7 @@ public function setElementsTca($tca) } } $fields = implode(",", $fieldArray); - + $GLOBALS['TCA']['tt_content']['ctrl']['typeicon_classes']["mask_" . $elementvalue["key"]] = 'mask-ce-' . $elementvalue["key"]; $GLOBALS['TCA']["tt_content"]["types"]["mask_" . $elementvalue["key"]]["columnsOverrides"]["bodytext"]["config"]['richtextConfiguration'] = 'default'; $GLOBALS['TCA']["tt_content"]["types"]["mask_" . $elementvalue["key"]]["columnsOverrides"]["bodytext"]["config"]['enableRichtext'] = 1; @@ -294,8 +294,8 @@ public function generateFieldsTca($tca) \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($columns[$tcakey], $tcavalue); } - - if (isset($columns[$tcakey]['rte'])){ + + if (isset($columns[$tcakey]['rte'])) { $columns[$tcakey]['config']['softref'] = 'rtehtmlarea_images,typolink_tag,images,email[subst],url'; } @@ -375,7 +375,11 @@ public function generateTableTca($table, $tca) 'type' => 'select', 'renderType' => 'selectSingle', 'items' => array( - array('LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.allLanguages', -1, 'flags-multiple'), + array( + 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.allLanguages', + -1, + 'flags-multiple' + ), ), 'special' => 'languages', 'default' => 0 diff --git a/Classes/Controller/WizardController.php b/Classes/Controller/WizardController.php index e681eab4..d4666280 100755 --- a/Classes/Controller/WizardController.php +++ b/Classes/Controller/WizardController.php @@ -275,8 +275,8 @@ protected function redirectByAction() /** * Check, if folders from extensionmanager-settings are existing * - * @author Gernot Ploiner * @return void + * @author Gernot Ploiner */ protected function checkFolders(): void { @@ -288,8 +288,8 @@ protected function checkFolders(): void /** * Creates missing folders that are needed for the use of mask - * @author Benjamin Butschell * @return bool $success + * @author Benjamin Butschell */ protected function createMissingFolders(): bool { diff --git a/Classes/Domain/Repository/StorageRepository.php b/Classes/Domain/Repository/StorageRepository.php index 693c8fbc..9523ab11 100644 --- a/Classes/Domain/Repository/StorageRepository.php +++ b/Classes/Domain/Repository/StorageRepository.php @@ -123,8 +123,8 @@ public function write($json) /** * Load Field - * @author Benjamin Butschell * @return array + * @author Benjamin Butschell */ public function loadField($type, $key) { @@ -136,8 +136,8 @@ public function loadField($type, $key) * Loads all the inline fields of an inline-field, recursively! * * @param string $parentKey key of the inline-field - * @author Benjamin Butschell * @return array + * @author Benjamin Butschell */ public function loadInlineFields($parentKey) { @@ -210,7 +210,8 @@ public function add($content) // If using a mask field with empty label, we have to set the "default" label $label = ''; foreach ($json[$content['type']]['elements'] as $element) { - if (is_array($element['columns']) && in_array($content['elements']['columns'][$index], $element['columns'], true)) { + if (is_array($element['columns']) && in_array($content['elements']['columns'][$index], + $element['columns'], true)) { $i = array_search($content['elements']['columns'][$index], $element['columns'], true); if (!empty($element['labels'][$i])) { $label = $element['labels'][$i]; @@ -351,13 +352,13 @@ public function activate($type, $key) /** * Removes a field from the json, also recursively all inline-fields - * @author Benjamin Butschell - * * @param string $table * @param string $field * @param array $json * @param array $remainingFields * @return array + * @author Benjamin Butschell + * */ private function removeField($table, $field, $json, $remainingFields = array()) { @@ -437,10 +438,10 @@ private function removeField($table, $field, $json, $remainingFields = array()) /** * Deletes all the empty settings of a table * - * @author Benjamin Butschell * @param string $table * @param array $json * @return array + * @author Benjamin Butschell */ private function cleanTable($table, $json) { diff --git a/Classes/Fluid/FluidTemplateContentObject.php b/Classes/Fluid/FluidTemplateContentObject.php index 246dd845..8afc1e2e 100755 --- a/Classes/Fluid/FluidTemplateContentObject.php +++ b/Classes/Fluid/FluidTemplateContentObject.php @@ -58,8 +58,8 @@ class FluidTemplateContentObject extends \TYPO3\CMS\Frontend\ContentObject\Fluid * Change variables for view * * @param array $conf Configuration - * @author Benjamin Butschell * @return void + * @author Benjamin Butschell */ protected function getContentObjectVariables(array $conf = array()) { diff --git a/Classes/Helper/InlineHelper.php b/Classes/Helper/InlineHelper.php index 5efddbb5..e7ac3f83 100644 --- a/Classes/Helper/InlineHelper.php +++ b/Classes/Helper/InlineHelper.php @@ -234,7 +234,7 @@ public function getInlineElements( } $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($childTable); - if(TYPO3_MODE=='BE'){ + if (TYPO3_MODE == 'BE') { $queryBuilder ->getRestrictions() ->removeAll() diff --git a/Classes/Imaging/IconProvider/ContentElementIconProvider.php b/Classes/Imaging/IconProvider/ContentElementIconProvider.php index 49099234..f2d36d3b 100644 --- a/Classes/Imaging/IconProvider/ContentElementIconProvider.php +++ b/Classes/Imaging/IconProvider/ContentElementIconProvider.php @@ -134,8 +134,8 @@ protected function generateMarkup(Icon $icon, array $options) /** * Checks if a preview icon is available in defined folder * @param string $key - * @author Benjamin Butschell * @return boolean + * @author Benjamin Butschell */ protected function isPreviewIconAvailable($key) { @@ -149,9 +149,9 @@ protected function isPreviewIconAvailable($key) /** * Checks if content element has set a fontawesome key * @param array $element - * @author Benjamin Butschell - * @todo implement * @return boolean + * @todo implement + * @author Benjamin Butschell */ protected function isFontAwesomeKeyAvailable($element) { @@ -160,8 +160,8 @@ protected function isFontAwesomeKeyAvailable($element) /** * @param string $key - * @author Benjamin Butschell * @return string + * @author Benjamin Butschell */ protected function getPreviewIconPath($key) { @@ -171,8 +171,8 @@ protected function getPreviewIconPath($key) /** * returns trimmed and unified font-awesome key * @param array $element - * @author Benjamin Butschell * @return string + * @author Benjamin Butschell */ protected function getFontAwesomeKey($element) { @@ -182,8 +182,8 @@ protected function getFontAwesomeKey($element) /** * returns trimmed and unified hex-code * @param array $element - * @author Benjamin Butschell * @return string + * @author Benjamin Butschell */ protected function getColor($element) { diff --git a/Classes/Utility/GeneralUtility.php b/Classes/Utility/GeneralUtility.php index 90af396d..fe8aa962 100755 --- a/Classes/Utility/GeneralUtility.php +++ b/Classes/Utility/GeneralUtility.php @@ -175,8 +175,8 @@ public function isBlindLinkOptionSet($fieldKey, $evalValue, $type = 'tt_content' /** * replace keys * - * @author Gernot Ploiner * @return array + * @author Gernot Ploiner */ public function replaceKey($data, $replace_key, $key = "--key--") { diff --git a/Configuration/TypoScript/setup.txt b/Configuration/TypoScript/setup.txt index 25caecf6..1edceff5 100644 --- a/Configuration/TypoScript/setup.txt +++ b/Configuration/TypoScript/setup.txt @@ -9,7 +9,7 @@ lib.tx_mask.content { # mask content elements are rendered with this snippet lib.maskContentElement = FLUIDTEMPLATE lib.maskContentElement { - dataProcessing { + dataProcessing { 100 = MASK\Mask\DataProcessing\MaskProcessor } } diff --git a/Documentation/Settings.yml b/Documentation/Settings.yml index ebe359f2..3a47174a 100644 --- a/Documentation/Settings.yml +++ b/Documentation/Settings.yml @@ -14,14 +14,14 @@ conf.py: release: intersphinx_mapping: t3tsref: - - http://docs.typo3.org/typo3cms/TyposcriptReference/ - - null + - http://docs.typo3.org/typo3cms/TyposcriptReference/ + - null latex_documents: - - - Index - - mask.tex - - mask - - - - manual + - - Index + - mask.tex + - mask + - + - manual latex_elements: papersize: a4paper pointsize: 10pt diff --git a/Resources/Private/Backend/Partials/Forms/Fields/Check/Tabs.html b/Resources/Private/Backend/Partials/Forms/Fields/Check/Tabs.html index 304e2922..41d2f337 100644 --- a/Resources/Private/Backend/Partials/Forms/Fields/Check/Tabs.html +++ b/Resources/Private/Backend/Partials/Forms/Fields/Check/Tabs.html @@ -3,7 +3,8 @@
        - +
        diff --git a/Resources/Private/Backend/Partials/Forms/Fields/Date/Tabs.html b/Resources/Private/Backend/Partials/Forms/Fields/Date/Tabs.html index 334824eb..e0aa104f 100644 --- a/Resources/Private/Backend/Partials/Forms/Fields/Date/Tabs.html +++ b/Resources/Private/Backend/Partials/Forms/Fields/Date/Tabs.html @@ -48,7 +48,7 @@
        + arguments="{key:key, elementKey:storage.key, field: field, excludePrefixOption: 1}"/>
        diff --git a/Resources/Private/Backend/Partials/Forms/Fields/Datetime/Tabs.html b/Resources/Private/Backend/Partials/Forms/Fields/Datetime/Tabs.html index 334824eb..e0aa104f 100644 --- a/Resources/Private/Backend/Partials/Forms/Fields/Datetime/Tabs.html +++ b/Resources/Private/Backend/Partials/Forms/Fields/Datetime/Tabs.html @@ -48,7 +48,7 @@
        + arguments="{key:key, elementKey:storage.key, field: field, excludePrefixOption: 1}"/>
      diff --git a/Resources/Private/Backend/Partials/Forms/Fields/Float/Tabs.html b/Resources/Private/Backend/Partials/Forms/Fields/Float/Tabs.html index 939b2a96..00ce2ca4 100644 --- a/Resources/Private/Backend/Partials/Forms/Fields/Float/Tabs.html +++ b/Resources/Private/Backend/Partials/Forms/Fields/Float/Tabs.html @@ -21,7 +21,8 @@
      - +
      diff --git a/Resources/Private/Backend/Partials/Forms/Fields/Inline/Tabs.html b/Resources/Private/Backend/Partials/Forms/Fields/Inline/Tabs.html index af71b254..88b355d2 100644 --- a/Resources/Private/Backend/Partials/Forms/Fields/Inline/Tabs.html +++ b/Resources/Private/Backend/Partials/Forms/Fields/Inline/Tabs.html @@ -45,7 +45,7 @@
      - + {element.label} diff --git a/Resources/Private/Backend/Partials/Forms/Fields/Integer/Tabs.html b/Resources/Private/Backend/Partials/Forms/Fields/Integer/Tabs.html index 939b2a96..00ce2ca4 100644 --- a/Resources/Private/Backend/Partials/Forms/Fields/Integer/Tabs.html +++ b/Resources/Private/Backend/Partials/Forms/Fields/Integer/Tabs.html @@ -21,7 +21,8 @@
      - +
      diff --git a/Resources/Private/Backend/Partials/Forms/Fields/Link/Tabs.html b/Resources/Private/Backend/Partials/Forms/Fields/Link/Tabs.html index 914f0dc6..f3b4a212 100644 --- a/Resources/Private/Backend/Partials/Forms/Fields/Link/Tabs.html +++ b/Resources/Private/Backend/Partials/Forms/Fields/Link/Tabs.html @@ -52,7 +52,8 @@
      - +
      diff --git a/Resources/Private/Backend/Partials/Forms/Fields/Radio/Tabs.html b/Resources/Private/Backend/Partials/Forms/Fields/Radio/Tabs.html index 9a6517d3..7cf85c43 100644 --- a/Resources/Private/Backend/Partials/Forms/Fields/Radio/Tabs.html +++ b/Resources/Private/Backend/Partials/Forms/Fields/Radio/Tabs.html @@ -2,7 +2,8 @@
      - +
      diff --git a/Resources/Private/Backend/Partials/Forms/Fields/Richtext/Tabs.html b/Resources/Private/Backend/Partials/Forms/Fields/Richtext/Tabs.html index 83d53a3f..dba17cf8 100644 --- a/Resources/Private/Backend/Partials/Forms/Fields/Richtext/Tabs.html +++ b/Resources/Private/Backend/Partials/Forms/Fields/Richtext/Tabs.html @@ -46,7 +46,8 @@
      - +
      diff --git a/Resources/Private/Backend/Partials/Forms/Fields/Select/Tabs.html b/Resources/Private/Backend/Partials/Forms/Fields/Select/Tabs.html index dd8c6278..658325bd 100644 --- a/Resources/Private/Backend/Partials/Forms/Fields/Select/Tabs.html +++ b/Resources/Private/Backend/Partials/Forms/Fields/Select/Tabs.html @@ -72,7 +72,8 @@
      - +
      diff --git a/Resources/Private/Backend/Partials/Forms/Fields/String/Tabs.html b/Resources/Private/Backend/Partials/Forms/Fields/String/Tabs.html index 6b963598..4c0534cd 100644 --- a/Resources/Private/Backend/Partials/Forms/Fields/String/Tabs.html +++ b/Resources/Private/Backend/Partials/Forms/Fields/String/Tabs.html @@ -54,7 +54,8 @@
      - +
      diff --git a/Resources/Private/Backend/Partials/Forms/Fields/Text/Tabs.html b/Resources/Private/Backend/Partials/Forms/Fields/Text/Tabs.html index f9498bed..b2e8980b 100644 --- a/Resources/Private/Backend/Partials/Forms/Fields/Text/Tabs.html +++ b/Resources/Private/Backend/Partials/Forms/Fields/Text/Tabs.html @@ -46,7 +46,8 @@
      - +
      diff --git a/Resources/Private/Backend/Partials/Forms/Tabs/Tabheaders.html b/Resources/Private/Backend/Partials/Forms/Tabs/Tabheaders.html index 692ee7ae..44d128cf 100644 --- a/Resources/Private/Backend/Partials/Forms/Tabs/Tabheaders.html +++ b/Resources/Private/Backend/Partials/Forms/Tabs/Tabheaders.html @@ -1,57 +1,57 @@ - + - + - + - + - + - + - + - + - + - + - + diff --git a/Resources/Private/Backend/Partials/General/Tabs.html b/Resources/Private/Backend/Partials/General/Tabs.html index 941ac8bb..c3b0c640 100644 --- a/Resources/Private/Backend/Partials/General/Tabs.html +++ b/Resources/Private/Backend/Partials/General/Tabs.html @@ -23,7 +23,8 @@
      Issues: - GitHub Issues + GitHub Issues

    • diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf index 6ef065ce..77d68fd1 100644 --- a/Resources/Private/Language/locallang.xlf +++ b/Resources/Private/Language/locallang.xlf @@ -599,7 +599,8 @@ - Mask configuration mask.json is missing. Create missing file or change configuration in extension manager. + Mask configuration mask.json is missing. Create missing file or change configuration in + extension manager. diff --git a/Resources/Public/Icons/Extension.svg b/Resources/Public/Icons/Extension.svg index 808d894a..e078f8f1 100644 --- a/Resources/Public/Icons/Extension.svg +++ b/Resources/Public/Icons/Extension.svg @@ -1,18 +1,19 @@ - + - + - - diff --git a/Resources/Public/Icons/Fieldtypes/Date.svg b/Resources/Public/Icons/Fieldtypes/Date.svg index eb3ff33b..b93e0d11 100644 --- a/Resources/Public/Icons/Fieldtypes/Date.svg +++ b/Resources/Public/Icons/Fieldtypes/Date.svg @@ -1,42 +1,43 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Resources/Public/Icons/Fieldtypes/File.svg b/Resources/Public/Icons/Fieldtypes/File.svg index c30bf5ae..2005a8af 100644 --- a/Resources/Public/Icons/Fieldtypes/File.svg +++ b/Resources/Public/Icons/Fieldtypes/File.svg @@ -1,18 +1,19 @@ - - - - - - - - - + + + + + + + + + diff --git a/Resources/Public/Icons/Fieldtypes/Float.svg b/Resources/Public/Icons/Fieldtypes/Float.svg index c88516dc..7794f1ea 100644 --- a/Resources/Public/Icons/Fieldtypes/Float.svg +++ b/Resources/Public/Icons/Fieldtypes/Float.svg @@ -1,46 +1,48 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/Resources/Public/Icons/Fieldtypes/Inline.svg b/Resources/Public/Icons/Fieldtypes/Inline.svg index 3f95fe39..f20461c6 100644 --- a/Resources/Public/Icons/Fieldtypes/Inline.svg +++ b/Resources/Public/Icons/Fieldtypes/Inline.svg @@ -1,7 +1,9 @@ - -Layer 1 - - - - - \ No newline at end of file + + Layer 1 + + + + + diff --git a/Resources/Public/Icons/Fieldtypes/Integer.svg b/Resources/Public/Icons/Fieldtypes/Integer.svg index f167bee0..691747cb 100644 --- a/Resources/Public/Icons/Fieldtypes/Integer.svg +++ b/Resources/Public/Icons/Fieldtypes/Integer.svg @@ -1,34 +1,35 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/Resources/Public/Icons/Fieldtypes/Link.svg b/Resources/Public/Icons/Fieldtypes/Link.svg index 675006cb..d0f3983f 100644 --- a/Resources/Public/Icons/Fieldtypes/Link.svg +++ b/Resources/Public/Icons/Fieldtypes/Link.svg @@ -1,26 +1,27 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/Resources/Public/Icons/Fieldtypes/Radio.svg b/Resources/Public/Icons/Fieldtypes/Radio.svg index d3ca3b5e..98a47fff 100644 --- a/Resources/Public/Icons/Fieldtypes/Radio.svg +++ b/Resources/Public/Icons/Fieldtypes/Radio.svg @@ -1,9 +1,12 @@ - - - - - - - - + + + + + + + + diff --git a/Resources/Public/Icons/Fieldtypes/Richtext.svg b/Resources/Public/Icons/Fieldtypes/Richtext.svg index a38abf29..e56e88bd 100644 --- a/Resources/Public/Icons/Fieldtypes/Richtext.svg +++ b/Resources/Public/Icons/Fieldtypes/Richtext.svg @@ -1,21 +1,22 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/Resources/Public/Icons/Fieldtypes/Select.svg b/Resources/Public/Icons/Fieldtypes/Select.svg index 93470263..8b3d18a9 100644 --- a/Resources/Public/Icons/Fieldtypes/Select.svg +++ b/Resources/Public/Icons/Fieldtypes/Select.svg @@ -1,25 +1,26 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/Resources/Public/Icons/Fieldtypes/String.svg b/Resources/Public/Icons/Fieldtypes/String.svg index abeee77b..73687d24 100644 --- a/Resources/Public/Icons/Fieldtypes/String.svg +++ b/Resources/Public/Icons/Fieldtypes/String.svg @@ -1,27 +1,28 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/Resources/Public/Icons/Fieldtypes/Tab.svg b/Resources/Public/Icons/Fieldtypes/Tab.svg index 3293c811..9632bac5 100644 --- a/Resources/Public/Icons/Fieldtypes/Tab.svg +++ b/Resources/Public/Icons/Fieldtypes/Tab.svg @@ -1,17 +1,18 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/Resources/Public/Icons/Fieldtypes/Text.svg b/Resources/Public/Icons/Fieldtypes/Text.svg index 01173cae..73b7c1db 100644 --- a/Resources/Public/Icons/Fieldtypes/Text.svg +++ b/Resources/Public/Icons/Fieldtypes/Text.svg @@ -1,17 +1,18 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/Resources/Public/Icons/module-mask_wizard.svg b/Resources/Public/Icons/module-mask_wizard.svg index 808d894a..e078f8f1 100644 --- a/Resources/Public/Icons/module-mask_wizard.svg +++ b/Resources/Public/Icons/module-mask_wizard.svg @@ -1,18 +1,19 @@ - + - + - - diff --git a/Resources/Public/Images/github_logo.svg b/Resources/Public/Images/github_logo.svg index d606fa15..9347c3b5 100644 --- a/Resources/Public/Images/github_logo.svg +++ b/Resources/Public/Images/github_logo.svg @@ -1,38 +1,40 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - \ No newline at end of file + diff --git a/Resources/Public/Scripts/libs.js b/Resources/Public/Scripts/libs.js index 21f2bc77..00c74ac5 100644 --- a/Resources/Public/Scripts/libs.js +++ b/Resources/Public/Scripts/libs.js @@ -535,8 +535,8 @@ }) } }, d.pseudos.nth = d.pseudos.eq; - for (b in{radio: !0, checkbox: !0, file: !0, password: !0, image: !0}) d.pseudos[b] = jb(b); - for (b in{submit: !0, reset: !0}) d.pseudos[b] = kb(b); + for (b in {radio: !0, checkbox: !0, file: !0, password: !0, image: !0}) d.pseudos[b] = jb(b); + for (b in {submit: !0, reset: !0}) d.pseudos[b] = kb(b); function nb() { } @@ -1150,7 +1150,7 @@ a = b = c = null }(), function () { var b, c, d = z.createElement("div"); - for (b in{ + for (b in { submit: !0, change: !0, focusin: !0 @@ -1305,7 +1305,7 @@ var d = "on" + b; a.detachEvent && (typeof a[d] === L && (a[d] = null), a.detachEvent(d, c)) }, n.Event = function (a, b) { - return this instanceof n.Event ? (a && a.type ? (this.originalEvent = a, this.type = a.type, this.isDefaultPrevented = a.defaultPrevented || void 0 === a.defaultPrevented && (a.returnValue === !1 || a.getPreventDefault && a.getPreventDefault()) ? bb : cb) : this.type = a, b && n.extend(this, b), this.timeStamp = a && a.timeStamp || n.now(), void(this[n.expando] = !0)) : new n.Event(a, b) + return this instanceof n.Event ? (a && a.type ? (this.originalEvent = a, this.type = a.type, this.isDefaultPrevented = a.defaultPrevented || void 0 === a.defaultPrevented && (a.returnValue === !1 || a.getPreventDefault && a.getPreventDefault()) ? bb : cb) : this.type = a, b && n.extend(this, b), this.timeStamp = a && a.timeStamp || n.now(), void (this[n.expando] = !0)) : new n.Event(a, b) }, n.Event.prototype = { isDefaultPrevented: cb, isPropagationStopped: cb, @@ -2115,7 +2115,7 @@ } }), sc && rc || (n.attrHooks.value = { set: function (a, b, c) { - return n.nodeName(a, "input") ? void(a.defaultValue = b) : nc && nc.set(a, b, c) + return n.nodeName(a, "input") ? void (a.defaultValue = b) : nc && nc.set(a, b, c) } }), rc || (nc = { set: function (a, b, c) { @@ -2399,7 +2399,7 @@ for (d in k.headers) v.setRequestHeader(d, k.headers[d]); if (k.beforeSend && (k.beforeSend.call(l, v, k) === !1 || 2 === t)) return v.abort(); u = "abort"; - for (d in{success: 1, error: 1, complete: 1}) v[d](k[d]); + for (d in {success: 1, error: 1, complete: 1}) v[d](k[d]); if (i = Nc(Jc, k, b, v)) { v.readyState = 1, h && m.trigger("ajaxSend", [v, k]), k.async && k.timeout > 0 && (g = setTimeout(function () { v.abort("timeout") @@ -2667,7 +2667,7 @@ n.fn[a] = function (d) { return W(this, function (a, d, e) { var f = ed(a); - return void 0 === e ? f ? b in f ? f[b] : f.document.documentElement[d] : a[d] : void(f ? f.scrollTo(c ? n(f).scrollLeft() : e, c ? e : n(f).scrollTop()) : a[d] = e) + return void 0 === e ? f ? b in f ? f[b] : f.document.documentElement[d] : a[d] : void (f ? f.scrollTo(c ? n(f).scrollLeft() : e, c ? e : n(f).scrollTop()) : a[d] = e) }, a, d, arguments.length, null) } }), n.each(["top", "left"], function (a, b) { diff --git a/Resources/Public/Scripts/scripts.js b/Resources/Public/Scripts/scripts.js index 3f2ec210..47e89a84 100644 --- a/Resources/Public/Scripts/scripts.js +++ b/Resources/Public/Scripts/scripts.js @@ -257,11 +257,11 @@ jQuery(document).ready(function () { }); // Select Field: Render type specific fields toggle jQuery(document).on("change", ".tx_mask_fieldcontent_select_renderType", function (a) { - if (jQuery(this).val() == 'selectMultipleSideBySide') { - jQuery(this).closest(".tx_mask_fieldcontent").find('.tx_mask_fieldcontent_renderType_selectMultipleSideBySide').show(); - } else { - jQuery(this).closest(".tx_mask_fieldcontent").find('.tx_mask_fieldcontent_renderType_selectMultipleSideBySide').hide(); - } + if (jQuery(this).val() == 'selectMultipleSideBySide') { + jQuery(this).closest(".tx_mask_fieldcontent").find('.tx_mask_fieldcontent_renderType_selectMultipleSideBySide').show(); + } else { + jQuery(this).closest(".tx_mask_fieldcontent").find('.tx_mask_fieldcontent_renderType_selectMultipleSideBySide').hide(); + } }); // initialize font-icon-picker diff --git a/Resources/Public/Styles/styles.css b/Resources/Public/Styles/styles.css index 22917eca..c47d95cd 100644 --- a/Resources/Public/Styles/styles.css +++ b/Resources/Public/Styles/styles.css @@ -702,6 +702,7 @@ UL.tx_mask_fieldtypes .tx_mask_fieldcontent_highlight { content: "\f077" !important; font-family: FontAwesome !important; } + .mask_issues_container { float: right !important; } @@ -726,7 +727,7 @@ UL.tx_mask_fieldtypes .tx_mask_fieldcontent_highlight { padding: 0 !important; } -.mask_footer_img_0,.mask_footer_img_1 { +.mask_footer_img_0, .mask_footer_img_1 { max-width: 280px; } @@ -748,7 +749,7 @@ UL.tx_mask_fieldtypes .tx_mask_fieldcontent_highlight { } .mask_footer_spacer_top { - width:auto; + width: auto; } .mask_footer_spacer_3 { @@ -821,6 +822,7 @@ UL.tx_mask_fieldtypes .tx_mask_fieldcontent_highlight { .mask_footer_blue { color: #5F9FD7; } + .mask_footer_img_0 { width: 90%; height: auto; diff --git a/ext_localconf.php b/ext_localconf.php index 0ae9fe6e..62a9d2ec 100755 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -104,7 +104,8 @@ function user_mask_beLayout($layout = null) } else { // If backend_layout and backend_layout_next_level is not set on current page, check backend_layout_next_level on rootline $sysPage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository'); try { - $rootline = (\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Utility\RootlineUtility::class, $uid))->get(); + $rootline = (\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Utility\RootlineUtility::class, + $uid))->get(); } catch (Exception $e) { $rootline = []; } From 81fb4bb6515366cf9ebd6fdf2bd7bc05a9c1e5ac Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Thu, 12 Mar 2020 17:21:00 +0100 Subject: [PATCH 33/93] [CLEANUP] replace double quotes with single quotes --- Classes/CodeGenerator/HtmlCodeGenerator.php | 48 ++--- Classes/CodeGenerator/SqlCodeGenerator.php | 16 +- Classes/CodeGenerator/TcaCodeGenerator.php | 176 +++++++++--------- .../CodeGenerator/TyposcriptCodeGenerator.php | 60 +++--- .../Controller/WizardContentController.php | 12 +- Classes/Controller/WizardController.php | 26 +-- Classes/Controller/WizardPageController.php | 8 +- Classes/DataProcessing/MaskProcessor.php | 2 +- .../Repository/BackendLayoutRepository.php | 18 +- .../Domain/Repository/StorageRepository.php | 120 ++++++------ Classes/Fluid/FluidTemplateContentObject.php | 4 +- Classes/Helper/FieldHelper.php | 158 ++++++++-------- Classes/Helper/InlineHelper.php | 56 +++--- Classes/Hooks/PageLayoutViewDrawItem.php | 22 +-- .../ContentElementIconProvider.php | 24 +-- Classes/ItemsProcFuncs/CTypeList.php | 30 +-- Classes/ItemsProcFuncs/ColPosList.php | 8 +- Classes/Utility/GeneralUtility.php | 20 +- Classes/ViewHelpers/CTypesViewHelper.php | 6 +- Classes/ViewHelpers/EvalViewHelper.php | 6 +- Classes/ViewHelpers/ItemsViewHelper.php | 2 +- .../ViewHelpers/JsOpenParamsViewHelper.php | 6 +- Classes/ViewHelpers/LabelViewHelper.php | 4 +- .../ViewHelpers/RteTransformViewHelper.php | 6 +- Configuration/TCA/Overrides/pages.php | 4 +- Configuration/TCA/Overrides/tt_content.php | 4 +- ext_emconf.php | 2 +- ext_localconf.php | 68 +++---- 28 files changed, 458 insertions(+), 458 deletions(-) diff --git a/Classes/CodeGenerator/HtmlCodeGenerator.php b/Classes/CodeGenerator/HtmlCodeGenerator.php index a09a9257..ad8a1399 100644 --- a/Classes/CodeGenerator/HtmlCodeGenerator.php +++ b/Classes/CodeGenerator/HtmlCodeGenerator.php @@ -44,9 +44,9 @@ class HtmlCodeGenerator extends \MASK\Mask\CodeGenerator\AbstractCodeGenerator public function generateHtml($key, $table) { $storage = $this->storageRepository->loadElement($table, $key); - $html = ""; - if ($storage["tca"]) { - foreach ($storage["tca"] as $fieldKey => $fieldConfig) { + $html = ''; + if ($storage['tca']) { + foreach ($storage['tca'] as $fieldKey => $fieldConfig) { $html .= $this->generateFieldHtml($fieldKey, $key, $table); } } @@ -63,32 +63,32 @@ public function generateHtml($key, $table) * @author Gernot Ploiner * @author Benjamin Butschell */ - protected function generateFieldHtml($fieldKey, $elementKey, $table, $datafield = "data") + protected function generateFieldHtml($fieldKey, $elementKey, $table, $datafield = 'data') { - $html = ""; + $html = ''; $fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); switch ($fieldHelper->getFormType($fieldKey, $elementKey, $table)) { - case "Check": - $html .= "{f:if(condition: " . $datafield . "." . $fieldKey . ", then: 'On', else: 'Off')}
      \n\n"; + case 'Check': + $html .= '{f:if(condition: ' . $datafield . '.' . $fieldKey . ", then: 'On', else: 'Off')}
      \n\n"; break; - case "Content": + case 'Content': $html .= '' . "\n"; - $html .= "\n"; + $html .= '\n"; $html .= '{' . $datafield . '_item.uid}
      ' . "\n"; $html .= "
      \n"; $html .= "
      \n\n"; break; - case "Date": + case 'Date': $html .= '' . "\n"; $html .= '{' . $datafield . '.' . $fieldKey . '}
      ' . "\n"; $html .= "
      \n\n"; break; - case "Datetime": + case 'Datetime': $html .= '' . "\n"; $html .= '{' . $datafield . '.' . $fieldKey . '}
      ' . "\n"; $html .= "
      \n\n"; break; - case "File": + case 'File': $html .= '' . "\n"; $html .= '
      @@ -96,37 +96,37 @@ protected function generateFieldHtml($fieldKey, $elementKey, $table, $datafield
      ' . "\n"; $html .= "
      \n\n"; break; - case "Float": + case 'Float': $html .= '' . "\n"; $html .= '{' . $datafield . '.' . $fieldKey . '}
      ' . "\n"; $html .= "
      \n\n"; break; - case "Inline": + case 'Inline': $html .= '' . "\n"; $html .= "
        \n"; - $html .= "\n
      • "; + $html .= '\n
      • "; $inlineFields = $this->storageRepository->loadInlineFields($fieldKey); if ($inlineFields) { foreach ($inlineFields as $inlineField) { - $html .= $this->generateFieldHtml($inlineField["maskKey"], $elementKey, $fieldKey, - $datafield . "_item") . "\n"; + $html .= $this->generateFieldHtml($inlineField['maskKey'], $elementKey, $fieldKey, + $datafield . '_item') . "\n"; } } $html .= "
      • \n
        " . "\n"; $html .= "
      \n"; $html .= "
      \n\n"; break; - case "Integer": + case 'Integer': $html .= '' . "\n"; $html .= '{' . $datafield . '.' . $fieldKey . '}
      ' . "\n"; $html .= "
      \n\n"; break; - case "Link": + case 'Link': $html .= '' . "\n"; $html .= '{' . $datafield . '.' . $fieldKey . '}
      ' . "\n"; $html .= "
      \n\n"; break; - case "Radio": + case 'Radio': $html .= '' . "\n"; $html .= ' Value is: 1 @@ -135,12 +135,12 @@ protected function generateFieldHtml($fieldKey, $elementKey, $table, $datafield
      ' . "\n"; $html .= "
      \n\n"; break; - case "Richtext": + case 'Richtext': $html .= '' . "\n"; $html .= '{' . $datafield . '.' . $fieldKey . '}
      ' . "\n"; $html .= "
      \n\n"; break; - case "Select": + case 'Select': $html .= '' . "\n"; $html .= ' Value is: 1 @@ -149,12 +149,12 @@ protected function generateFieldHtml($fieldKey, $elementKey, $table, $datafield
      ' . "\n"; $html .= "
      \n\n"; break; - case "String": + case 'String': $html .= '' . "\n"; $html .= '{' . $datafield . '.' . $fieldKey . '}
      ' . "\n"; $html .= "
      \n\n"; break; - case "Text": + case 'Text': $html .= '' . "\n"; $html .= '{' . $datafield . '.' . $fieldKey . '}
      ' . "\n"; $html .= "
      \n\n"; diff --git a/Classes/CodeGenerator/SqlCodeGenerator.php b/Classes/CodeGenerator/SqlCodeGenerator.php index d74ade6e..1c4ad355 100644 --- a/Classes/CodeGenerator/SqlCodeGenerator.php +++ b/Classes/CodeGenerator/SqlCodeGenerator.php @@ -120,17 +120,17 @@ public function getSqlByConfiguration($json) { $sql_content = array(); $types = array_keys($json); - $nonIrreTables = array("pages", "tt_content"); + $nonIrreTables = array('pages', 'tt_content'); $fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); // Generate SQL-Statements if ($types) { foreach ($types as $type) { - if ($json[$type]["sql"]) { + if ($json[$type]['sql']) { // If type/table is an irre table, then create table for it if (array_search($type, $nonIrreTables) === false) { - $sql_content[] = "CREATE TABLE " . $type . " ( + $sql_content[] = 'CREATE TABLE ' . $type . " ( uid int(11) NOT NULL auto_increment, pid int(11) DEFAULT '0' NOT NULL, @@ -170,17 +170,17 @@ public function getSqlByConfiguration($json) );\n"; } - foreach ($json[$type]["sql"] as $field) { + foreach ($json[$type]['sql'] as $field) { if ($field) { foreach ($field as $table => $fields) { if ($fields) { foreach ($fields as $field => $definition) { - $sql_content[] = "CREATE TABLE " . $table . " (\n\t" . $field . " " . $definition . "\n);\n"; + $sql_content[] = 'CREATE TABLE ' . $table . " (\n\t" . $field . ' ' . $definition . "\n);\n"; // if this field is a content field, also add parent columns - $fieldType = $fieldHelper->getFormType($field, "", $table); - if ($fieldType == "Content") { - $sql_content[] = "CREATE TABLE tt_content (\n\t" . $field . "_parent" . " " . $definition . ",\n\t" . "KEY " . $field . " (" . $field . "_parent,pid,deleted)" . "\n);\n"; + $fieldType = $fieldHelper->getFormType($field, '', $table); + if ($fieldType == 'Content') { + $sql_content[] = "CREATE TABLE tt_content (\n\t" . $field . '_parent' . ' ' . $definition . ",\n\t" . 'KEY ' . $field . ' (' . $field . '_parent,pid,deleted)' . "\n);\n"; } } } diff --git a/Classes/CodeGenerator/TcaCodeGenerator.php b/Classes/CodeGenerator/TcaCodeGenerator.php index ffb331d7..e5f8e5a3 100644 --- a/Classes/CodeGenerator/TcaCodeGenerator.php +++ b/Classes/CodeGenerator/TcaCodeGenerator.php @@ -40,33 +40,33 @@ class TcaCodeGenerator extends AbstractCodeGenerator public function setInlineTca($json) { // Generate TCA for IRRE Fields and Tables - $notIrreTables = array("pages", "tt_content", "sys_file_reference"); + $notIrreTables = array('pages', 'tt_content', 'sys_file_reference'); if ($json) { foreach ($json as $table => $subJson) { $fieldTCA = array(); if (array_search($table, $notIrreTables) === false) { // Generate Table TCA - $this->generateTableTca($table, $subJson["tca"]); + $this->generateTableTca($table, $subJson['tca']); // Generate Field TCA - $fieldTCA = $this->generateFieldsTca($subJson["tca"]); + $fieldTCA = $this->generateFieldsTca($subJson['tca']); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns($table, $fieldTCA); // set label for inline - if (!empty($json["tt_content"]["tca"][$table]["inlineLabel"])) { - $fields = array_keys($subJson["tca"]); - if (array_search($json["tt_content"]["tca"][$table]["inlineLabel"], $fields) !== false) { - $GLOBALS["TCA"][$table]["ctrl"]['label'] = $json["tt_content"]["tca"][$table]["inlineLabel"]; + if (!empty($json['tt_content']['tca'][$table]['inlineLabel'])) { + $fields = array_keys($subJson['tca']); + if (array_search($json['tt_content']['tca'][$table]['inlineLabel'], $fields) !== false) { + $GLOBALS['TCA'][$table]['ctrl']['label'] = $json['tt_content']['tca'][$table]['inlineLabel']; } } // set icon for inline - if (!empty($json["tt_content"]["tca"][$table]["inlineIcon"])) { - $GLOBALS["TCA"][$table]["ctrl"]['iconfile'] = $json["tt_content"]["tca"][$table]["inlineIcon"]; + if (!empty($json['tt_content']['tca'][$table]['inlineIcon'])) { + $GLOBALS['TCA'][$table]['ctrl']['iconfile'] = $json['tt_content']['tca'][$table]['inlineIcon']; } else { - $GLOBALS["TCA"][$table]["ctrl"]['iconfile'] = "EXT:mask/Resources/Public/Icons/Extension.svg"; + $GLOBALS['TCA'][$table]['ctrl']['iconfile'] = 'EXT:mask/Resources/Public/Icons/Extension.svg'; } // hide table in list view - $GLOBALS["TCA"][$table]['ctrl']['hideTable'] = true; + $GLOBALS['TCA'][$table]['ctrl']['hideTable'] = true; } } } @@ -82,7 +82,7 @@ public function setElementsTca($tca) { $fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); - $defaultTabs = ",--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance,--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.frames;frames,--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.appearanceLinks;appearanceLinks,--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language,--palette--;;language,--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,--palette--;;hidden,--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.access;access,--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:categories,--div--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_category.tabs.category,categories,--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:notes,rowDescription,--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:extended"; + $defaultTabs = ',--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance,--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.frames;frames,--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.appearanceLinks;appearanceLinks,--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language,--palette--;;language,--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,--palette--;;hidden,--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.access;access,--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:categories,--div--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_category.tabs.category,categories,--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:notes,rowDescription,--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:extended'; // add gridelements fields, to make mask work with gridelements out of the box $gridelements = ''; @@ -98,30 +98,30 @@ public function setElementsTca($tca) ]; foreach ($tca as $elementvalue) { - if (!$elementvalue["hidden"]) { + if (!$elementvalue['hidden']) { - $prependTabs = "--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general,"; + $prependTabs = '--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general,'; $fieldArray = array(); - $label = $elementvalue["shortLabel"] ? $elementvalue["shortLabel"] : $elementvalue["label"]; // Optional shortLabel + $label = $elementvalue['shortLabel'] ? $elementvalue['shortLabel'] : $elementvalue['label']; // Optional shortLabel // add new entry in CType selectbox \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPlugin(array( $label, - "mask_" . $elementvalue["key"], - 'mask-ce-' . $elementvalue["key"] - ), "CType", "mask"); + 'mask_' . $elementvalue['key'], + 'mask-ce-' . $elementvalue['key'] + ), 'CType', 'mask'); // add all the fields that should be shown - if (is_array($elementvalue["columns"])) { - foreach ($elementvalue["columns"] as $index => $fieldKey) { + if (is_array($elementvalue['columns'])) { + foreach ($elementvalue['columns'] as $index => $fieldKey) { // check if this field is of type tab - $formType = $fieldHelper->getFormType($fieldKey, $elementvalue["key"], "tt_content"); - if ($formType == "Tab") { - $label = $fieldHelper->getLabel($elementvalue["key"], $fieldKey, "tt_content"); + $formType = $fieldHelper->getFormType($fieldKey, $elementvalue['key'], 'tt_content'); + if ($formType == 'Tab') { + $label = $fieldHelper->getLabel($elementvalue['key'], $fieldKey, 'tt_content'); // if a tab is in the first position then change the name of the general tab if ($index === 0) { - $prependTabs = '--div--;' . $label . "," . $prependTabs; + $prependTabs = '--div--;' . $label . ',' . $prependTabs; } else { // otherwise just add new tab $fieldArray[] = '--div--;' . $label; @@ -131,12 +131,12 @@ public function setElementsTca($tca) } } } - $fields = implode(",", $fieldArray); + $fields = implode(',', $fieldArray); - $GLOBALS['TCA']['tt_content']['ctrl']['typeicon_classes']["mask_" . $elementvalue["key"]] = 'mask-ce-' . $elementvalue["key"]; - $GLOBALS['TCA']["tt_content"]["types"]["mask_" . $elementvalue["key"]]["columnsOverrides"]["bodytext"]["config"]['richtextConfiguration'] = 'default'; - $GLOBALS['TCA']["tt_content"]["types"]["mask_" . $elementvalue["key"]]["columnsOverrides"]["bodytext"]["config"]['enableRichtext'] = 1; - $GLOBALS['TCA']["tt_content"]["types"]["mask_" . $elementvalue["key"]]["showitem"] = $prependTabs . $fields . $defaultTabs . $gridelements; + $GLOBALS['TCA']['tt_content']['ctrl']['typeicon_classes']['mask_' . $elementvalue['key']] = 'mask-ce-' . $elementvalue['key']; + $GLOBALS['TCA']['tt_content']['types']['mask_' . $elementvalue['key']]['columnsOverrides']['bodytext']['config']['richtextConfiguration'] = 'default'; + $GLOBALS['TCA']['tt_content']['types']['mask_' . $elementvalue['key']]['columnsOverrides']['bodytext']['config']['enableRichtext'] = 1; + $GLOBALS['TCA']['tt_content']['types']['mask_' . $elementvalue['key']]['showitem'] = $prependTabs . $fields . $defaultTabs . $gridelements; } } } @@ -151,21 +151,21 @@ public function setElementsTca($tca) public function setPageTca($tca) { $fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); - $prependTabs = "--div--;Content-Fields,"; + $prependTabs = '--div--;Content-Fields,'; if ($tca) { $i = 0; foreach ($tca as $fieldKey => $config) { // no information about which element this field is for at this point - $elements = $fieldHelper->getElementsWhichUseField($fieldKey, "pages"); + $elements = $fieldHelper->getElementsWhichUseField($fieldKey, 'pages'); $element = $elements[0]; // check if this field is of type tab - $formType = $fieldHelper->getFormType($fieldKey, $element["key"], "pages"); - if ($formType == "Tab") { - $label = $fieldHelper->getLabel($element["key"], $fieldKey, "pages"); + $formType = $fieldHelper->getFormType($fieldKey, $element['key'], 'pages'); + if ($formType == 'Tab') { + $label = $fieldHelper->getLabel($element['key'], $fieldKey, 'pages'); // if a tab is in the first position then change the name of the general tab if ($i === 0) { - $prependTabs = '--div--;' . $label . ","; + $prependTabs = '--div--;' . $label . ','; } else { // otherwise just add new tab $fieldArray[] = '--div--;' . $label; @@ -178,7 +178,7 @@ public function setPageTca($tca) } if (!empty($fieldArray)) { - $pageFieldString = $prependTabs . implode(",", $fieldArray); + $pageFieldString = $prependTabs . implode(',', $fieldArray); } else { $pageFieldString = $prependTabs; } @@ -202,7 +202,7 @@ public function generateFieldsTca($tca) if ($tcavalue) { foreach ($tcavalue as $fieldkey => $fieldvalue) { // Add File-Config for file-field - if ($fieldkey == "options" && $fieldvalue == "file") { + if ($fieldkey == 'options' && $fieldvalue == 'file') { $fieldName = $tcakey; $customSettingOverride = array( 'overrideChildTca' => array( @@ -229,61 +229,61 @@ public function generateFieldsTca($tca) ) ); - $customSettingOverride["appearance"] = $tcavalue["config"]["appearance"]; - if ($customSettingOverride["appearance"]["fileUploadAllowed"] == "") { - $customSettingOverride["appearance"]["fileUploadAllowed"] = false; + $customSettingOverride['appearance'] = $tcavalue['config']['appearance']; + if ($customSettingOverride['appearance']['fileUploadAllowed'] == '') { + $customSettingOverride['appearance']['fileUploadAllowed'] = false; } - if ($customSettingOverride["appearance"]["useSortable"] == "") { - $customSettingOverride["appearance"]["useSortable"] = 0; + if ($customSettingOverride['appearance']['useSortable'] == '') { + $customSettingOverride['appearance']['useSortable'] = 0; } else { - $customSettingOverride["appearance"]["useSortable"] = 1; + $customSettingOverride['appearance']['useSortable'] = 1; } - if ($tcavalue["config"]["filter"]["0"]["parameters"]["allowedFileExtensions"] != "") { - $allowedFileExtensions = $tcavalue["config"]["filter"]["0"]["parameters"]["allowedFileExtensions"]; + if ($tcavalue['config']['filter']['0']['parameters']['allowedFileExtensions'] != '') { + $allowedFileExtensions = $tcavalue['config']['filter']['0']['parameters']['allowedFileExtensions']; } else { $allowedFileExtensions = $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']; } - $columns[$tcakey]["config"] = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig($fieldName, + $columns[$tcakey]['config'] = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig($fieldName, $customSettingOverride, $allowedFileExtensions); } // check if field is actually a tab - if (isset($fieldvalue["type"]) && $fieldvalue["type"] == "tab") { + if (isset($fieldvalue['type']) && $fieldvalue['type'] == 'tab') { $addToTca = false; } // Fill missing tablename in TCA-Config for inline-fields - if ($fieldkey == "config" && $tcavalue[$fieldkey]["foreign_table"] == "--inlinetable--") { - $tcavalue[$fieldkey]["foreign_table"] = $tcakey; + if ($fieldkey == 'config' && $tcavalue[$fieldkey]['foreign_table'] == '--inlinetable--') { + $tcavalue[$fieldkey]['foreign_table'] = $tcakey; } // set date ranges if date or datetime field - if ($fieldkey == "config" && ($tcavalue[$fieldkey]["dbType"] == "date" || $tcavalue[$fieldkey]["dbType"] == "datetime")) { - if ($tcavalue[$fieldkey]["range"]["upper"] != "") { - $date = new \DateTime($tcavalue[$fieldkey]["range"]["upper"]); - $tcavalue[$fieldkey]["range"]["upper"] = $date->getTimestamp() + 86400; + if ($fieldkey == 'config' && ($tcavalue[$fieldkey]['dbType'] == 'date' || $tcavalue[$fieldkey]['dbType'] == 'datetime')) { + if ($tcavalue[$fieldkey]['range']['upper'] != '') { + $date = new \DateTime($tcavalue[$fieldkey]['range']['upper']); + $tcavalue[$fieldkey]['range']['upper'] = $date->getTimestamp() + 86400; } - if ($tcavalue[$fieldkey]["range"]["lower"] != "") { - $date = new \DateTime($tcavalue[$fieldkey]["range"]["lower"]); - $tcavalue[$fieldkey]["range"]["lower"] = $date->getTimestamp() + 86400; + if ($tcavalue[$fieldkey]['range']['lower'] != '') { + $date = new \DateTime($tcavalue[$fieldkey]['range']['lower']); + $tcavalue[$fieldkey]['range']['lower'] = $date->getTimestamp() + 86400; } } // set correct rendertype if format (code highlighting) is set in text tca - if ($fieldkey == "config" && $tcavalue[$fieldkey]["format"] != "") { - $tcavalue[$fieldkey]["renderType"] = "t3editor"; + if ($fieldkey == 'config' && $tcavalue[$fieldkey]['format'] != '') { + $tcavalue[$fieldkey]['renderType'] = 't3editor'; } // make some adjustmens to content fields if ( - $fieldkey == "config" && - $tcavalue[$fieldkey]["foreign_table"] == "tt_content" && - $tcavalue[$fieldkey]["type"] == "inline" + $fieldkey == 'config' && + $tcavalue[$fieldkey]['foreign_table'] == 'tt_content' && + $tcavalue[$fieldkey]['type'] == 'inline' ) { - $tcavalue[$fieldkey]["foreign_field"] = $tcakey . "_parent"; - if ($tcavalue["cTypes"]) { - $tcavalue[$fieldkey]["overrideChildTca"]["columns"]["CType"]["config"]["default"] = reset($tcavalue["cTypes"]); + $tcavalue[$fieldkey]['foreign_field'] = $tcakey . '_parent'; + if ($tcavalue['cTypes']) { + $tcavalue[$fieldkey]['overrideChildTca']['columns']['CType']['config']['default'] = reset($tcavalue['cTypes']); } } @@ -300,13 +300,13 @@ public function generateFieldsTca($tca) } // Unset some values that are not needed in TCA - unset($columns[$tcakey]["options"]); - unset($columns[$tcakey]["key"]); - unset($columns[$tcakey]["rte"]); - unset($columns[$tcakey]["inlineParent"]); - unset($columns[$tcakey]["inlineLabel"]); - unset($columns[$tcakey]["inlineIcon"]); - unset($columns[$tcakey]["cTypes"]); + unset($columns[$tcakey]['options']); + unset($columns[$tcakey]['key']); + unset($columns[$tcakey]['rte']); + unset($columns[$tcakey]['inlineParent']); + unset($columns[$tcakey]['inlineLabel']); + unset($columns[$tcakey]['inlineIcon']); + unset($columns[$tcakey]['cTypes']); // $GLOBALS['TCA']["tt_content"]["types"]["mask_asdfsdaf"]["columnsOverrides"]["tx_mask_".$tcakey]["config"]['enableRichtext'] = 1; @@ -481,7 +481,7 @@ public function generateTableTca($table, $tca) $generalUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Utility\\GeneralUtility'); // now add all the fields that should be shown - $prependTabs = "sys_language_uid, l10n_parent, l10n_diffsource, hidden, "; + $prependTabs = 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, '; if ($tca) { $i = 0; uasort($tca, function ($columnA, $columnB) { @@ -492,12 +492,12 @@ public function generateTableTca($table, $tca) foreach ($tca as $fieldKey => $configuration) { // check if this field is of type tab - $formType = $fieldHelper->getFormType($fieldKey, "", $table); - if ($formType == "Tab") { - $label = $configuration["label"]; + $formType = $fieldHelper->getFormType($fieldKey, '', $table); + if ($formType == 'Tab') { + $label = $configuration['label']; // if a tab is in the first position then change the name of the general tab if ($i === 0) { - $prependTabs = '--div--;' . $label . "," . $prependTabs; + $prependTabs = '--div--;' . $label . ',' . $prependTabs; } else { // otherwise just add new tab $fields[] = '--div--;' . $label; @@ -520,22 +520,22 @@ public function generateTableTca($table, $tca) // Adjust TCA-Template $tableTca = $tcaTemplate; - $tableTca["ctrl"]["title"] = $table; - $tableTca["ctrl"]["label"] = $labelField; - $tableTca["ctrl"]["searchFields"] = implode(",", (array)$fields); - $tableTca["interface"]["showRecordFieldList"] = "sys_language_uid, l10n_parent, l10n_diffsource, hidden, " . implode(", ", + $tableTca['ctrl']['title'] = $table; + $tableTca['ctrl']['label'] = $labelField; + $tableTca['ctrl']['searchFields'] = implode(',', (array)$fields); + $tableTca['interface']['showRecordFieldList'] = 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, ' . implode(', ', (array)$fields); - $tableTca["types"]["1"]["showitem"] = $prependTabs . implode(", ", - (array)$fields) . ", --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime"; + $tableTca['types']['1']['showitem'] = $prependTabs . implode(', ', + (array)$fields) . ', --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'; - $tableTca["columns"]["l10n_parent"]["config"]["foreign_table"] = $table; - $tableTca["columns"]["l10n_parent"]["config"]["foreign_table_where"] = 'AND ' . $table . '.pid=###CURRENT_PID### AND ' . $table . '.sys_language_uid IN (-1,0)'; + $tableTca['columns']['l10n_parent']['config']['foreign_table'] = $table; + $tableTca['columns']['l10n_parent']['config']['foreign_table_where'] = 'AND ' . $table . '.pid=###CURRENT_PID### AND ' . $table . '.sys_language_uid IN (-1,0)'; - $tableTca["columns"]["parentid"]["config"]["foreign_table"] = $parentTable; - $tableTca["columns"]["parentid"]["config"]["foreign_table_where"] = 'AND ' . $parentTable . '.pid=###CURRENT_PID### AND ' . $parentTable . '.sys_language_uid IN (-1,###REC_FIELD_sys_language_uid###)'; + $tableTca['columns']['parentid']['config']['foreign_table'] = $parentTable; + $tableTca['columns']['parentid']['config']['foreign_table_where'] = 'AND ' . $parentTable . '.pid=###CURRENT_PID### AND ' . $parentTable . '.sys_language_uid IN (-1,###REC_FIELD_sys_language_uid###)'; // Add some stuff we need to make irre work like it should - $GLOBALS["TCA"][$table] = $tableTca; + $GLOBALS['TCA'][$table] = $tableTca; } /** @@ -545,7 +545,7 @@ public function generateTableTca($table, $tca) */ public function allowInlineTablesOnStandardPages($configuration) { - $notIrreTables = array("pages", "tt_content", "sys_file_reference"); + $notIrreTables = array('pages', 'tt_content', 'sys_file_reference'); if ($configuration) { foreach ($configuration as $table => $subJson) { if (array_search($table, $notIrreTables) === false) { diff --git a/Classes/CodeGenerator/TyposcriptCodeGenerator.php b/Classes/CodeGenerator/TyposcriptCodeGenerator.php index 4f2486b0..c6dc1744 100644 --- a/Classes/CodeGenerator/TyposcriptCodeGenerator.php +++ b/Classes/CodeGenerator/TyposcriptCodeGenerator.php @@ -48,45 +48,45 @@ class TyposcriptCodeGenerator extends AbstractCodeGenerator public function generateTsConfig($json) { // generate page TSconfig - $content = ""; + $content = ''; $iconRegistry = GeneralUtility::makeInstance("TYPO3\CMS\Core\Imaging\IconRegistry"); // make content-Elements - if ($json["tt_content"]["elements"]) { - foreach ($json["tt_content"]["elements"] as $element) { + if ($json['tt_content']['elements']) { + foreach ($json['tt_content']['elements'] as $element) { // Register icons for contentelements - $iconIdentifier = 'mask-ce-' . $element["key"]; + $iconIdentifier = 'mask-ce-' . $element['key']; $iconRegistry->registerIcon( $iconIdentifier, "MASK\Mask\Imaging\IconProvider\ContentElementIconProvider", array( - 'contentElementKey' => $element["key"] + 'contentElementKey' => $element['key'] ) ); - if (!$element["hidden"]) { + if (!$element['hidden']) { // add the content element wizard for each content element $wizard = [ 'header' => 'LLL:EXT:mask/Resources/Private/Language/locallang_mask.xlf:new_content_element_tab', - 'elements.mask_' . $element["key"] => [ + 'elements.mask_' . $element['key'] => [ 'iconIdentifier' => $iconIdentifier, - 'title' => $element["label"], - 'description' => $element["description"], + 'title' => $element['label'], + 'description' => $element['description'], 'tt_content_defValues' => [ - 'CType' => 'mask_' . $element["key"] + 'CType' => 'mask_' . $element['key'] ] ], ]; $content .= "mod.wizards.newContentElement.wizardItems.mask {\n"; $content .= $this->convertArrayToTypoScript($wizard, '', 1); - $content .= "\tshow := addToList(mask_" . $element["key"] . ");\n"; + $content .= "\tshow := addToList(mask_" . $element['key'] . ");\n"; $content .= "}\n"; // and switch the labels depending on which content element is selected $content .= "\n[isMaskContentType('" . $element['key'] . "')]\n"; - if ($element["columns"]) { - foreach ($element["columns"] as $index => $column) { - $content .= " TCEFORM.tt_content." . $column . ".label = " . $element["labels"][$index] . "\n"; + if ($element['columns']) { + foreach ($element['columns'] as $index => $column) { + $content .= ' TCEFORM.tt_content.' . $column . '.label = ' . $element['labels'][$index] . "\n"; } } $content .= "[end]\n\n"; @@ -104,21 +104,21 @@ public function generateTsConfig($json) public function generatePageTyposcript($json) { $pageColumns = array(); - $disableColumns = ""; - $pagesContent = ""; - if ($json["pages"]["elements"]) { - foreach ($json["pages"]["elements"] as $element) { + $disableColumns = ''; + $pagesContent = ''; + if ($json['pages']['elements']) { + foreach ($json['pages']['elements'] as $element) { // Labels for pages - $pagesContent .= "\n[userFunc = user_mask_beLayout(" . $element["key"] . ")]\n"; + $pagesContent .= "\n[userFunc = user_mask_beLayout(" . $element['key'] . ")]\n"; // if page has backendlayout with this element-key - if ($element["columns"]) { - foreach ($element["columns"] as $index => $column) { - $pagesContent .= " TCEFORM.pages." . $column . ".label = " . $element["labels"][$index] . "\n"; + if ($element['columns']) { + foreach ($element['columns'] as $index => $column) { + $pagesContent .= ' TCEFORM.pages.' . $column . '.label = ' . $element['labels'][$index] . "\n"; } $pagesContent .= "\n"; - foreach ($element["columns"] as $index => $column) { + foreach ($element['columns'] as $index => $column) { $pageColumns[] = $column; - $pagesContent .= " TCEFORM.pages." . $column . ".disabled = 0\n"; + $pagesContent .= ' TCEFORM.pages.' . $column . ".disabled = 0\n"; } } $pagesContent .= "[end]\n"; @@ -126,7 +126,7 @@ public function generatePageTyposcript($json) } // disable all fields by default and only activate by condition foreach ($pageColumns as $column) { - $disableColumns .= "TCEFORM.pages." . $column . ".disabled = 1\n"; + $disableColumns .= 'TCEFORM.pages.' . $column . ".disabled = 1\n"; } $pagesContent = $disableColumns . "\n" . $pagesContent; return $pagesContent; @@ -185,11 +185,11 @@ public function generateSetupTyposcript($configuration, $settings) ], 'lib.maskContentElement'); // for each content element - if ($configuration["tt_content"]["elements"]) { - foreach ($configuration["tt_content"]["elements"] as $element) { - if (!$element["hidden"]) { - $setupContent[] = "tt_content.mask_" . $element["key"] . - " =< lib.maskContentElement\ntt_content.mask_" . $element["key"] . + if ($configuration['tt_content']['elements']) { + foreach ($configuration['tt_content']['elements'] as $element) { + if (!$element['hidden']) { + $setupContent[] = 'tt_content.mask_' . $element['key'] . + " =< lib.maskContentElement\ntt_content.mask_" . $element['key'] . " {\ntemplateName = " . MaskUtility::getTemplatePath( $settings, $element['key'], diff --git a/Classes/Controller/WizardContentController.php b/Classes/Controller/WizardContentController.php index 7bbccb0f..f6f1d61d 100755 --- a/Classes/Controller/WizardContentController.php +++ b/Classes/Controller/WizardContentController.php @@ -89,8 +89,8 @@ public function createAction($storage) { $this->storageRepository->add($storage); $this->generateAction(); - $html = $this->htmlCodeGenerator->generateHtml($storage["elements"]["key"], 'tt_content'); - $this->saveHtml($storage["elements"]["key"], $html); + $html = $this->htmlCodeGenerator->generateHtml($storage['elements']['key'], 'tt_content'); + $this->saveHtml($storage['elements']['key'], $html); $this->addFlashMessage(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_mask.content.newcontentelement', 'mask')); $this->redirectByAction(); @@ -123,8 +123,8 @@ public function updateAction($storage) { $this->storageRepository->update($storage); $this->generateAction(); - $html = $this->htmlCodeGenerator->generateHtml($storage["elements"]["key"], 'tt_content'); - $this->saveHtml($storage["elements"]["key"], $html); + $html = $this->htmlCodeGenerator->generateHtml($storage['elements']['key'], 'tt_content'); + $this->saveHtml($storage['elements']['key'], $html); $this->addFlashMessage(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_mask.content.updatedcontentelement', 'mask')); $this->redirectByAction(); @@ -171,7 +171,7 @@ public function purgeAction($key, $type) */ public function hideAction($key) { - $this->storageRepository->hide("tt_content", $key); + $this->storageRepository->hide('tt_content', $key); $this->generateAction(); $this->addFlashMessage(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_mask.content.hiddencontentelement', 'mask')); @@ -186,7 +186,7 @@ public function hideAction($key) */ public function activateAction($key) { - $this->storageRepository->activate("tt_content", $key); + $this->storageRepository->activate('tt_content', $key); $this->generateAction(); $this->addFlashMessage(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_mask.content.activatedcontentelement', 'mask')); diff --git a/Classes/Controller/WizardController.php b/Classes/Controller/WizardController.php index d4666280..2b302759 100755 --- a/Classes/Controller/WizardController.php +++ b/Classes/Controller/WizardController.php @@ -158,12 +158,12 @@ public function generateAction() protected function prepareStorage(&$storage) { // Fill storage with additional data before assigning to view - if ($storage["tca"]) { - foreach ($storage["tca"] as $key => $field) { + if ($storage['tca']) { + foreach ($storage['tca'] as $key => $field) { if (is_array($field)) { - if ($field["config"]["type"] == "inline") { - $storage["tca"][$key]["inlineFields"] = $this->storageRepository->loadInlineFields($key); - uasort($storage["tca"][$key]["inlineFields"], function ($columnA, $columnB) { + if ($field['config']['type'] == 'inline') { + $storage['tca'][$key]['inlineFields'] = $this->storageRepository->loadInlineFields($key); + uasort($storage['tca'][$key]['inlineFields'], function ($columnA, $columnB) { $a = isset($columnA['order']) ? (int)$columnA['order'] : 0; $b = isset($columnB['order']) ? (int)$columnB['order'] : 0; return $a - $b; @@ -254,19 +254,19 @@ public function checkElementKey(ServerRequest $request, Response $response): Res protected function redirectByAction() { $params = $this->request->getArguments(); - $formAction = $params["formAction"]; + $formAction = $params['formAction']; $arguments = array(); - if ($params["storage"]["type"] == "pages") { - $arguments["layoutIdentifier"] = $this->backendLayoutRepository->findByIdentifier($params["storage"]["elements"]["key"], - explode(",", $this->extSettings['backendlayout_pids']))->getIdentifier(); + if ($params['storage']['type'] == 'pages') { + $arguments['layoutIdentifier'] = $this->backendLayoutRepository->findByIdentifier($params['storage']['elements']['key'], + explode(',', $this->extSettings['backendlayout_pids']))->getIdentifier(); } else { - $arguments["key"] = $params["storage"]["elements"]["key"]; - $arguments["type"] = $params["storage"]["type"]; + $arguments['key'] = $params['storage']['elements']['key']; + $arguments['type'] = $params['storage']['type']; } - if (key_exists("save", $formAction)) { + if (key_exists('save', $formAction)) { $this->redirect('edit', null, null, $arguments); } else { - if (key_exists("saveAndExit", $formAction)) { + if (key_exists('saveAndExit', $formAction)) { $this->redirect('list'); } } diff --git a/Classes/Controller/WizardPageController.php b/Classes/Controller/WizardPageController.php index bc2605cc..c6d9a701 100755 --- a/Classes/Controller/WizardPageController.php +++ b/Classes/Controller/WizardPageController.php @@ -52,7 +52,7 @@ class WizardPageController extends \MASK\Mask\Controller\WizardController public function listAction() { $settings = $this->settingsService->get(); - $backendLayouts = $this->backendLayoutRepository->findAll(explode(",", $settings['backendlayout_pids'])); + $backendLayouts = $this->backendLayoutRepository->findAll(explode(',', $settings['backendlayout_pids'])); $this->view->assign('backendLayouts', $backendLayouts); } @@ -64,7 +64,7 @@ public function listAction() public function newAction() { $settings = $this->settingsService->get(); - $backendLayouts = $this->backendLayoutRepository->findAll(explode(",", $settings['backendlayout_pids'])); + $backendLayouts = $this->backendLayoutRepository->findAll(explode(',', $settings['backendlayout_pids'])); $this->view->assign('backendLayouts', $backendLayouts); } @@ -92,10 +92,10 @@ public function editAction($layoutIdentifier = null) { $settings = $this->settingsService->get(); $layout = $this->backendLayoutRepository->findByIdentifier($layoutIdentifier, - explode(",", $settings['backendlayout_pids'])); + explode(',', $settings['backendlayout_pids'])); if ($layout) { - $storage = $this->storageRepository->loadElement("pages", $layoutIdentifier); + $storage = $this->storageRepository->loadElement('pages', $layoutIdentifier); $this->prepareStorage($storage); $this->view->assign('backendLayout', $layout); $this->view->assign('storage', $storage); diff --git a/Classes/DataProcessing/MaskProcessor.php b/Classes/DataProcessing/MaskProcessor.php index e5b3fad5..dbccdd53 100644 --- a/Classes/DataProcessing/MaskProcessor.php +++ b/Classes/DataProcessing/MaskProcessor.php @@ -37,7 +37,7 @@ public function process( $objectManager = GeneralUtility::makeInstance(ObjectManager::class); $this->inlineHelper = $objectManager->get(InlineHelper::class); - $this->inlineHelper->addFilesToData($processedData['data'], "tt_content"); + $this->inlineHelper->addFilesToData($processedData['data'], 'tt_content'); $this->inlineHelper->addIrreToData($processedData['data']); return $processedData; } diff --git a/Classes/Domain/Repository/BackendLayoutRepository.php b/Classes/Domain/Repository/BackendLayoutRepository.php index bf9f4379..d491995b 100644 --- a/Classes/Domain/Repository/BackendLayoutRepository.php +++ b/Classes/Domain/Repository/BackendLayoutRepository.php @@ -74,10 +74,10 @@ public function findAll($pageTsPids = array()) $pageTsConfig = (array)\TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($pid); $dataProviderContext = $this->backendLayoutView->createDataProviderContext()->setPageTsConfig($pageTsConfig); $backendLayoutCollections = $this->backendLayoutView->getDataProviderCollection()->getBackendLayoutCollections($dataProviderContext); - foreach ($backendLayoutCollections["default"]->getAll() as $backendLayout) { + foreach ($backendLayoutCollections['default']->getAll() as $backendLayout) { $backendLayouts[$backendLayout->getIdentifier()] = $backendLayout; } - foreach ($backendLayoutCollections["pagets"]->getAll() as $backendLayout) { + foreach ($backendLayoutCollections['pagets']->getAll() as $backendLayout) { $backendLayouts[$backendLayout->getIdentifier()] = $backendLayout; } } @@ -86,7 +86,7 @@ public function findAll($pageTsPids = array()) $databaseBackendLayouts = parent::findAll(); foreach ($databaseBackendLayouts as $layout) { $backendLayout = new \TYPO3\CMS\Backend\View\BackendLayout\BackendLayout($layout->getUid(), - $layout->getTitle(), ""); + $layout->getTitle(), ''); if ($layout->getIcon()) { $backendLayout->setIconPath('/uploads/media/' . $layout->getIcon()); } @@ -118,11 +118,11 @@ public function findIdentifierByPid($pid) $data = $statement->fetch(FetchMode::ASSOCIATIVE); $statement->closeCursor(); - $backend_layout = $data["backend_layout"]; - $backend_layout_next_level = $data["backend_layout_next_level"]; - if ($backend_layout !== "") { // If backend_layout is set on current page + $backend_layout = $data['backend_layout']; + $backend_layout_next_level = $data['backend_layout_next_level']; + if ($backend_layout !== '') { // If backend_layout is set on current page return $backend_layout; - } elseif ($backend_layout_next_level !== "") { // If backend_layout_next_level is set on current page + } elseif ($backend_layout_next_level !== '') { // If backend_layout_next_level is set on current page return $backend_layout_next_level; } else { // If backend_layout and backend_layout_next_level is not set on current page, check backend_layout_next_level on rootline $sysPage = GeneralUtility::makeInstance(PageRepository::class); @@ -132,8 +132,8 @@ public function findIdentifierByPid($pid) $rootline = []; } foreach ($rootline as $page) { - if ($page["backend_layout_next_level"] !== "") { - return $page["backend_layout_next_level"]; + if ($page['backend_layout_next_level'] !== '') { + return $page['backend_layout_next_level']; } } } diff --git a/Classes/Domain/Repository/StorageRepository.php b/Classes/Domain/Repository/StorageRepository.php index 9523ab11..edc69c25 100644 --- a/Classes/Domain/Repository/StorageRepository.php +++ b/Classes/Domain/Repository/StorageRepository.php @@ -129,7 +129,7 @@ public function write($json) public function loadField($type, $key) { $json = $this->load(); - return $json[$type]["tca"][$key]; + return $json[$type]['tca'][$key]; } /** @@ -144,13 +144,13 @@ public function loadInlineFields($parentKey) $json = $this->load(); $inlineFields = array(); foreach ($json as $table) { - if ($table["tca"]) { - foreach ($table["tca"] as $key => $tca) { - if ($tca["inlineParent"] == $parentKey) { - if ($tca["config"]["type"] == "inline") { - $tca["inlineFields"] = $this->loadInlineFields($key); + if ($table['tca']) { + foreach ($table['tca'] as $key => $tca) { + if ($tca['inlineParent'] == $parentKey) { + if ($tca['config']['type'] == 'inline') { + $tca['inlineFields'] = $this->loadInlineFields($key); } - $tca["maskKey"] = "tx_mask_" . $tca["key"]; + $tca['maskKey'] = 'tx_mask_' . $tca['key']; $inlineFields[] = $tca; } } @@ -168,18 +168,18 @@ public function loadElement($type, $key) { $json = $this->load(); $fields = array(); - $columns = $json[$type]["elements"][$key]["columns"]; + $columns = $json[$type]['elements'][$key]['columns']; //Check if it is an array before trying to count it if (is_array($columns) && count($columns) > 0) { foreach ($columns as $fieldName) { - $fields[$fieldName] = $json[$type]["tca"][$fieldName]; + $fields[$fieldName] = $json[$type]['tca'][$fieldName]; } } if (count($fields) > 0) { - $json[$type]["elements"][$key]["tca"] = $fields; + $json[$type]['elements'][$key]['tca'] = $fields; } - return $json[$type]["elements"][$key]; + return $json[$type]['elements'][$key]; } /** @@ -193,11 +193,11 @@ public function add($content) $json = $this->load(); // Create JSON elements Array: - foreach ($content["elements"] as $key => $value) { + foreach ($content['elements'] as $key => $value) { // delete columns and labels of irre-fields from elements - if ($key == "columns" || $key == "labels") { + if ($key == 'columns' || $key == 'labels') { foreach ($value as $index => $column) { - if (!$content["tca"][$index]["inlineParent"]) { + if (!$content['tca'][$index]['inlineParent']) { $contentColumns[] = $column; } else { unset($value[$index]); @@ -223,71 +223,71 @@ public function add($content) } } } - $json[$content["type"]]["elements"][$content["elements"]["key"]][$key] = $value; + $json[$content['type']]['elements'][$content['elements']['key']][$key] = $value; } $contentColumns = array(); $columns = array(); // delete columns and labels of irre-fields from elements - if ($content["elements"]["columns"]) { - foreach ($content["elements"]["columns"] as $index => $column) { - if (!$content["tca"][$index]["inlineParent"]) { + if ($content['elements']['columns']) { + foreach ($content['elements']['columns'] as $index => $column) { + if (!$content['tca'][$index]['inlineParent']) { $contentColumns[] = $column; } else { - unset($content["elements"]["columns"][$index]); - unset($content["elements"]["labels"][$index]); + unset($content['elements']['columns'][$index]); + unset($content['elements']['labels'][$index]); } $columns[] = $column; } } // Create JSON sql Array: - if (is_array($content["sql"])) { - foreach ($content["sql"] as $table => $sqlArray) { + if (is_array($content['sql'])) { + foreach ($content['sql'] as $table => $sqlArray) { foreach ($sqlArray as $index => $type) { - $fieldname = "tx_mask_" . $columns[$index]; - $json[$table]["sql"][$fieldname][$table][$fieldname] = $type; + $fieldname = 'tx_mask_' . $columns[$index]; + $json[$table]['sql'][$fieldname][$table][$fieldname] = $type; } } } // Create JSON tca Array: - if (is_array($content["tca"])) { + if (is_array($content['tca'])) { - foreach ($content["tca"] as $key => $value) { + foreach ($content['tca'] as $key => $value) { $inlineField = false; // if this field is inline-field - if ($value["inlineParent"]) { - $type = $value["inlineParent"]; + if ($value['inlineParent']) { + $type = $value['inlineParent']; $inlineField = true; } else { - $type = $content["type"]; + $type = $content['type']; } - $json[$type]["tca"][$columns[$key]] = $value; + $json[$type]['tca'][$columns[$key]] = $value; // add rte flag if inline and rte if ($inlineField) { - if ($content["elements"]["options"][$key] == "rte") { - $json[$type]["tca"][$columns[$key]]["rte"] = "1"; + if ($content['elements']['options'][$key] == 'rte') { + $json[$type]['tca'][$columns[$key]]['rte'] = '1'; } } // Only add columns to elements if it is no inlinefield if (!$inlineField) { - $json[$type]["elements"][$content["elements"]["key"]]["columns"][$key] = "tx_mask_" . $columns[$key]; + $json[$type]['elements'][$content['elements']['key']]['columns'][$key] = 'tx_mask_' . $columns[$key]; } - $json[$type]["tca"]["tx_mask_" . $columns[$key]] = $json[$type]["tca"][$columns[$key]]; - $json[$type]["tca"]["tx_mask_" . $columns[$key]]["key"] = $columns[$key]; + $json[$type]['tca']['tx_mask_' . $columns[$key]] = $json[$type]['tca'][$columns[$key]]; + $json[$type]['tca']['tx_mask_' . $columns[$key]]['key'] = $columns[$key]; if ($inlineField) { - $json[$type]["tca"]["tx_mask_" . $columns[$key]]["order"] = $key; + $json[$type]['tca']['tx_mask_' . $columns[$key]]['order'] = $key; } - unset($json[$type]["tca"][$columns[$key]]); + unset($json[$type]['tca'][$columns[$key]]); } } @@ -309,8 +309,8 @@ public function remove($type, $key, $remainingFields = array()) $json = $this->load(); // Remove - $columns = $json[$type]["elements"][$key]["columns"]; - unset($json[$type]["elements"][$key]); + $columns = $json[$type]['elements'][$key]['columns']; + unset($json[$type]['elements'][$key]); if (is_array($columns)) { foreach ($columns as $field) { $json = $this->removeField($type, $field, $json, $remainingFields); @@ -330,7 +330,7 @@ public function hide($type, $key) { // Load $json = $this->load(); - $json[$type]["elements"][$key]["hidden"] = 1; + $json[$type]['elements'][$key]['hidden'] = 1; $this->sortJson($json); $this->write($json); } @@ -345,7 +345,7 @@ public function activate($type, $key) { // Load $json = $this->load(); - unset($json[$type]["elements"][$key]["hidden"]); + unset($json[$type]['elements'][$key]['hidden']); $this->sortJson($json); $this->write($json); } @@ -367,10 +367,10 @@ private function removeField($table, $field, $json, $remainingFields = array()) // check if this field is used in any other elements $elementsInUse = array(); - if ($json[$table]["elements"]) { - foreach ($json[$table]["elements"] as $element) { - if ($element["columns"]) { - foreach ($element["columns"] as $column) { + if ($json[$table]['elements']) { + foreach ($json[$table]['elements'] as $element) { + if ($element['columns']) { + foreach ($element['columns'] as $column) { if ($column == $field) { $elementsInUse[] = $element; } @@ -384,7 +384,7 @@ private function removeField($table, $field, $json, $remainingFields = array()) $fatherFound = false; if ($remainingFields) { foreach ($remainingFields as $remainingField) { - if ($field == "tx_mask_" . $remainingField) { + if ($field == 'tx_mask_' . $remainingField) { $fatherFound = true; } } @@ -392,7 +392,7 @@ private function removeField($table, $field, $json, $remainingFields = array()) $fatherGetsDeleted = !$fatherFound; // if the field is a repeating field, make some exceptions - if ($json[$table]["tca"][$field]["config"]["type"] == "inline") { + if ($json[$table]['tca'][$field]['config']['type'] == 'inline') { $inlineFields = $this->loadInlineFields($field); if ($inlineFields) { // Recursively delete all inline-fields if necessary @@ -401,19 +401,19 @@ private function removeField($table, $field, $json, $remainingFields = array()) // check if the fields are really deleted, or if they are just deleted temporarly for update action if ($remainingFields) { foreach ($remainingFields as $remainingField) { - if ($inlineField["key"] == $remainingField) { + if ($inlineField['key'] == $remainingField) { $found = true; } } } if ($found) { // was not really deleted => can be deleted temporarly because it will be readded - $json = $this->removeField($inlineField["inlineParent"], "tx_mask_" . $inlineField["key"], + $json = $this->removeField($inlineField['inlineParent'], 'tx_mask_' . $inlineField['key'], $json); } else { // was really deleted and can only be deleted if father is not in use in another element if (($fatherGetsDeleted && count($elementsInUse) == 0) || !$fatherGetsDeleted) { - $json = $this->removeField($inlineField["inlineParent"], "tx_mask_" . $inlineField["key"], + $json = $this->removeField($inlineField['inlineParent'], 'tx_mask_' . $inlineField['key'], $json); } } @@ -423,13 +423,13 @@ private function removeField($table, $field, $json, $remainingFields = array()) // then delete the field, if it is not in use in another element if (count($elementsInUse) < 1) { - unset($json[$table]["tca"][$field]); - unset($json[$table]["sql"][$field]); + unset($json[$table]['tca'][$field]); + unset($json[$table]['sql'][$field]); // If field is of type file, also delete entry in sys_file_reference - if ($this->fieldHelper->getFormType($field) == "File") { - unset($json["sys_file_reference"]["sql"][$field]); - $json = $this->cleanTable("sys_file_reference", $json); + if ($this->fieldHelper->getFormType($field) == 'File') { + unset($json['sys_file_reference']['sql'][$field]); + $json = $this->cleanTable('sys_file_reference', $json); } } return $this->cleanTable($table, $json); @@ -445,11 +445,11 @@ private function removeField($table, $field, $json, $remainingFields = array()) */ private function cleanTable($table, $json) { - if ($json[$table]["tca"] && count($json[$table]["tca"]) < 1) { - unset($json[$table]["tca"]); + if ($json[$table]['tca'] && count($json[$table]['tca']) < 1) { + unset($json[$table]['tca']); } - if ($json[$table]["sql"] && count($json[$table]["sql"]) < 1) { - unset($json[$table]["sql"]); + if ($json[$table]['sql'] && count($json[$table]['sql']) < 1) { + unset($json[$table]['sql']); } if ($json[$table] && count($json[$table]) < 1) { unset($json[$table]); @@ -464,7 +464,7 @@ private function cleanTable($table, $json) */ public function update($content) { - $this->remove($content["type"], $content["orgkey"], $content["elements"]["columns"]); + $this->remove($content['type'], $content['orgkey'], $content['elements']['columns']); $this->add($content); } diff --git a/Classes/Fluid/FluidTemplateContentObject.php b/Classes/Fluid/FluidTemplateContentObject.php index 8afc1e2e..b4fa0985 100755 --- a/Classes/Fluid/FluidTemplateContentObject.php +++ b/Classes/Fluid/FluidTemplateContentObject.php @@ -71,8 +71,8 @@ protected function getContentObjectVariables(array $conf = array()) // Make some enhancements to data $data = $variables['data']; - $this->inlineHelper->addFilesToData($data, "pages"); - $this->inlineHelper->addIrreToData($data, "pages"); + $this->inlineHelper->addFilesToData($data, 'pages'); + $this->inlineHelper->addIrreToData($data, 'pages'); $variables['data'] = $data; return $variables; diff --git a/Classes/Helper/FieldHelper.php b/Classes/Helper/FieldHelper.php index edac70f1..6ef08dc4 100644 --- a/Classes/Helper/FieldHelper.php +++ b/Classes/Helper/FieldHelper.php @@ -61,15 +61,15 @@ public function __construct(\MASK\Mask\Domain\Repository\StorageRepository $stor * @return array elements in use * @author Benjamin Butschell */ - public function getElementsWhichUseField($key, $type = "tt_content") + public function getElementsWhichUseField($key, $type = 'tt_content') { $storage = $this->storageRepository->load(); $elementsInUse = array(); - if ($storage[$type]["elements"]) { - foreach ($storage[$type]["elements"] as $element) { - if ($element["columns"]) { - foreach ($element["columns"] as $column) { + if ($storage[$type]['elements']) { + foreach ($storage[$type]['elements'] as $element) { + if ($element['columns']) { + foreach ($element['columns'] as $column) { if ($column == $key) { $elementsInUse[] = $element; } @@ -89,21 +89,21 @@ public function getElementsWhichUseField($key, $type = "tt_content") * @return string Label * @author Benjamin Butschell */ - public function getLabel($elementKey, $fieldKey, $type = "tt_content") + public function getLabel($elementKey, $fieldKey, $type = 'tt_content') { $storage = $this->storageRepository->load(); $fieldIndex = -1; - if ($storage[$type]["elements"][$elementKey]["columns"] && count($storage[$type]["elements"][$elementKey]["columns"]) > 0) { - foreach ($storage[$type]["elements"][$elementKey]["columns"] as $index => $column) { + if ($storage[$type]['elements'][$elementKey]['columns'] && count($storage[$type]['elements'][$elementKey]['columns']) > 0) { + foreach ($storage[$type]['elements'][$elementKey]['columns'] as $index => $column) { if ($column == $fieldKey) { $fieldIndex = $index; } } } if ($fieldIndex >= 0) { - $label = $storage[$type]["elements"][$elementKey]["labels"][$fieldIndex]; + $label = $storage[$type]['elements'][$elementKey]['labels'][$fieldIndex]; } else { - $label = ""; + $label = ''; } return $label; } @@ -117,9 +117,9 @@ public function getLabel($elementKey, $fieldKey, $type = "tt_content") * @return string formType * @author Benjamin Butschell */ - public function getFormType($fieldKey, $elementKey = "", $type = "tt_content") + public function getFormType($fieldKey, $elementKey = '', $type = 'tt_content') { - $formType = "String"; + $formType = 'String'; // Load element and TCA of field if ($elementKey) { @@ -127,62 +127,62 @@ public function getFormType($fieldKey, $elementKey = "", $type = "tt_content") } // load tca for field from $GLOBALS - $tca = $GLOBALS["TCA"][$type]["columns"][$fieldKey]; - if (!$tca["config"]) { - $tca = $GLOBALS["TCA"][$type]["columns"]["tx_mask_" . $fieldKey]; + $tca = $GLOBALS['TCA'][$type]['columns'][$fieldKey]; + if (!$tca['config']) { + $tca = $GLOBALS['TCA'][$type]['columns']['tx_mask_' . $fieldKey]; } - if (!$tca["config"]) { - $tca = $element["tca"][$fieldKey]; + if (!$tca['config']) { + $tca = $element['tca'][$fieldKey]; } // if field is in inline table or $GLOBALS["TCA"] is not yet filled, load tca from json - if (!in_array($type, array("tt_content", "pages")) || $tca == null) { + if (!in_array($type, array('tt_content', 'pages')) || $tca == null) { $tca = $this->storageRepository->loadField($type, $fieldKey); - if (!$tca["config"]) { - $tca = $this->storageRepository->loadField($type, "tx_mask_" . $fieldKey); + if (!$tca['config']) { + $tca = $this->storageRepository->loadField($type, 'tx_mask_' . $fieldKey); } } - $tcaType = $tca["config"]["type"]; - $evals = explode(",", $tca["config"]["eval"]); + $tcaType = $tca['config']['type']; + $evals = explode(',', $tca['config']['eval']); - if ($tca["options"] == "file") { - $formType = "File"; + if ($tca['options'] == 'file') { + $formType = 'File'; } // And decide via different tca settings which formType it is switch ($tcaType) { - case "input": - $formType = "String"; - if (array_search(strtolower("int"), $evals) !== false) { - $formType = "Integer"; + case 'input': + $formType = 'String'; + if (array_search(strtolower('int'), $evals) !== false) { + $formType = 'Integer'; } else { - if (array_search(strtolower("double2"), $evals) !== false) { - $formType = "Float"; + if (array_search(strtolower('double2'), $evals) !== false) { + $formType = 'Float'; } else { - if (array_search(strtolower("date"), $evals) !== false) { - $formType = "Date"; + if (array_search(strtolower('date'), $evals) !== false) { + $formType = 'Date'; } else { - if (array_search(strtolower("datetime"), $evals) !== false) { - $formType = "Datetime"; + if (array_search(strtolower('datetime'), $evals) !== false) { + $formType = 'Datetime'; } else { - if (isset($tca["config"]["renderType"]) && $tca["config"]["renderType"] === "inputLink") { - $formType = "Link"; + if (isset($tca['config']['renderType']) && $tca['config']['renderType'] === 'inputLink') { + $formType = 'Link'; } else { - $formType = "String"; + $formType = 'String'; } } } } } break; - case "text": - $formType = "Text"; - if (in_array($type, array("tt_content", "pages"))) { + case 'text': + $formType = 'Text'; + if (in_array($type, array('tt_content', 'pages'))) { if ($elementKey) { $fieldNumberKey = -1; - if (is_array($element["columns"])) { - foreach ($element["columns"] as $numberKey => $column) { + if (is_array($element['columns'])) { + foreach ($element['columns'] as $numberKey => $column) { if ($column == $fieldKey) { $fieldNumberKey = $numberKey; } @@ -190,57 +190,57 @@ public function getFormType($fieldKey, $elementKey = "", $type = "tt_content") } if ($fieldNumberKey >= 0) { - $option = $element["options"][$fieldNumberKey]; - if ($option == "rte") { - $formType = "Richtext"; + $option = $element['options'][$fieldNumberKey]; + if ($option == 'rte') { + $formType = 'Richtext'; } else { - $formType = "Text"; + $formType = 'Text'; } } } else { - $formType = "Text"; + $formType = 'Text'; } } else { - if ($tca["rte"]) { - $formType = "Richtext"; + if ($tca['rte']) { + $formType = 'Richtext'; } else { - $formType = "Text"; + $formType = 'Text'; } } break; - case "check": - $formType = "Check"; + case 'check': + $formType = 'Check'; break; - case "radio": - $formType = "Radio"; + case 'radio': + $formType = 'Radio'; break; - case "select": - $formType = "Select"; + case 'select': + $formType = 'Select'; break; - case "group": + case 'group': break; - case "none": + case 'none': break; - case "passthrough": + case 'passthrough': break; - case "user": + case 'user': break; - case "flex": + case 'flex': break; - case "inline": - $formType = "Inline"; - if ($tca["config"]["foreign_table"] == "sys_file_reference") { - $formType = "File"; + case 'inline': + $formType = 'Inline'; + if ($tca['config']['foreign_table'] == 'sys_file_reference') { + $formType = 'File'; } else { - if ($tca["config"]["foreign_table"] == "tt_content") { - $formType = "Content"; + if ($tca['config']['foreign_table'] == 'tt_content') { + $formType = 'Content'; } else { - $formType = "Inline"; + $formType = 'Inline'; } } break; - case "tab": - $formType = "Tab"; + case 'tab': + $formType = 'Tab'; break; default: break; @@ -257,7 +257,7 @@ public function getFormType($fieldKey, $elementKey = "", $type = "tt_content") * @return string $excludeInlineFields only search in tt_content and pages * @author Benjamin Butschell */ - public function getFieldType($fieldKey, $elementKey = "", $excludeInlineFields = false) + public function getFieldType($fieldKey, $elementKey = '', $excludeInlineFields = false) { $storage = $this->storageRepository->load(); @@ -267,21 +267,21 @@ public function getFieldType($fieldKey, $elementKey = "", $excludeInlineFields = } else { $types = array(); } - $types[] = "pages"; - $types[] = "tt_content"; + $types[] = 'pages'; + $types[] = 'tt_content'; $types = array_unique($types); - $fieldType = ""; + $fieldType = ''; $found = false; foreach ($types as $type) { - if ($storage[$type]["elements"] && !$found) { - foreach ($storage[$type]["elements"] as $element) { + if ($storage[$type]['elements'] && !$found) { + foreach ($storage[$type]['elements'] as $element) { // if this is the element we search for, or no special element was given, // and the element has columns and the fieldType wasn't found yet - if (($element["key"] == $elementKey || $elementKey == "") && $element["columns"] && !$found) { + if (($element['key'] == $elementKey || $elementKey == '') && $element['columns'] && !$found) { - foreach ($element["columns"] as $column) { + foreach ($element['columns'] as $column) { if ($column == $fieldKey && !$found) { $fieldType = $type; $found = true; @@ -290,7 +290,7 @@ public function getFieldType($fieldKey, $elementKey = "", $excludeInlineFields = } } } else { - if (is_array($storage[$type]["tca"][$fieldKey])) { + if (is_array($storage[$type]['tca'][$fieldKey])) { $fieldType = $type; $found = true; } diff --git a/Classes/Helper/InlineHelper.php b/Classes/Helper/InlineHelper.php index e7ac3f83..815f5f76 100644 --- a/Classes/Helper/InlineHelper.php +++ b/Classes/Helper/InlineHelper.php @@ -81,12 +81,12 @@ public function __construct(\MASK\Mask\Domain\Repository\StorageRepository $stor * @param string $table * @author Benjamin Butschell */ - public function addFilesToData(&$data, $table = "tt_content") + public function addFilesToData(&$data, $table = 'tt_content') { - if ($data["_LOCALIZED_UID"]) { - $uid = $data["_LOCALIZED_UID"]; + if ($data['_LOCALIZED_UID']) { + $uid = $data['_LOCALIZED_UID']; } else { - $uid = $data["uid"]; + $uid = $data['uid']; } // using is_numeric in favor to is_int @@ -102,15 +102,15 @@ public function addFilesToData(&$data, $table = "tt_content") $storage = $this->storageRepository->load(); /* @var $fileRepository \TYPO3\CMS\Core\Resource\FileRepository */ $fileRepository = $this->objectManager->get("TYPO3\CMS\Core\Resource\FileRepository"); - $contentFields = array("media", "image", "assets"); - if ($storage[$table]["tca"]) { - foreach ($storage[$table]["tca"] as $fieldKey => $field) { + $contentFields = array('media', 'image', 'assets'); + if ($storage[$table]['tca']) { + foreach ($storage[$table]['tca'] as $fieldKey => $field) { $contentFields[] = $fieldKey; } } if ($contentFields) { foreach ($contentFields as $fieldKey) { - if ($fieldHelper->getFormType($fieldKey, "", $table) == "File") { + if ($fieldHelper->getFormType($fieldKey, '', $table) == 'File') { $data[$fieldKey] = $fileRepository->findByRelation($table, $fieldKey, $uid); } } @@ -125,11 +125,11 @@ public function addFilesToData(&$data, $table = "tt_content") * @param string $cType * @author Benjamin Butschell */ - public function addIrreToData(&$data, $table = "tt_content", $cType = "") + public function addIrreToData(&$data, $table = 'tt_content', $cType = '') { - if ($cType == "") { - $cType = $data["CType"]; + if ($cType == '') { + $cType = $data['CType']; } $fieldHelper = GeneralUtility::makeInstance(FieldHelper::class); @@ -137,10 +137,10 @@ public function addIrreToData(&$data, $table = "tt_content", $cType = "") $elementFields = []; // if the table is tt_content, load the element and all its columns - if ($table == "tt_content") { - $element = $this->storageRepository->loadElement($table, str_replace("mask_", "", $cType)); - $elementFields = $element["columns"]; - } elseif ($table == "pages") { + if ($table == 'tt_content') { + $element = $this->storageRepository->loadElement($table, str_replace('mask_', '', $cType)); + $elementFields = $element['columns']; + } elseif ($table == 'pages') { // if the table is pages, then load the pid if (isset($data['uid'])) { @@ -153,7 +153,7 @@ public function addIrreToData(&$data, $table = "tt_content", $cType = "") $table, str_replace('pagets__', '', $backendLayoutIdentifier) ); - $elementFields = $element["columns"]; + $elementFields = $element['columns']; } else { // if no backendlayout was found, just load all fields, if there are fields @@ -175,17 +175,17 @@ public function addIrreToData(&$data, $table = "tt_content", $cType = "") foreach ($elementFields as $field) { $fieldKeyPrefix = $field; - $fieldKey = str_replace("tx_mask_", "", $field); + $fieldKey = str_replace('tx_mask_', '', $field); $type = $fieldHelper->getFormType($fieldKey, $cType, $table); // if it is of type inline and has to be filled (IRRE, FAL) - if ($type == "Inline") { - $elements = $this->getInlineElements($data, $fieldKeyPrefix, $cType, "parentid", $table); + if ($type == 'Inline') { + $elements = $this->getInlineElements($data, $fieldKeyPrefix, $cType, 'parentid', $table); $data[$fieldKeyPrefix] = $elements; // or if it is of type Content (Nested Content) and has to be filled - } elseif ($type == "Content") { - $elements = $this->getInlineElements($data, $fieldKeyPrefix, $cType, $fieldKeyPrefix . "_parent", - "tt_content", "tt_content"); + } elseif ($type == 'Content') { + $elements = $this->getInlineElements($data, $fieldKeyPrefix, $cType, $fieldKeyPrefix . '_parent', + 'tt_content', 'tt_content'); $data[$fieldKeyPrefix] = $elements; } } @@ -208,8 +208,8 @@ public function getInlineElements( $data, $name, $cType, - $parentFieldName = "parentid", - $parenttable = "tt_content", + $parentFieldName = 'parentid', + $parenttable = 'tt_content', $childTable = null ) { // if the name of the child table is not explicitely given, take field key @@ -223,14 +223,14 @@ public function getInlineElements( $enableFields = $GLOBALS['TSFE']->cObj->enableFields($childTable); } else { $sysLangUid = $data['sys_language_uid']; - $enableFields = " AND " . $childTable . ".deleted = 0"; + $enableFields = ' AND ' . $childTable . '.deleted = 0'; } // by default, the uid of the parent is $data["uid"] - $parentUid = $data["uid"]; + $parentUid = $data['uid']; - if ($GLOBALS['TSFE']->sys_language_uid != 0 && $data["_LOCALIZED_UID"] != "") { - $parentUid = $data["_LOCALIZED_UID"]; + if ($GLOBALS['TSFE']->sys_language_uid != 0 && $data['_LOCALIZED_UID'] != '') { + $parentUid = $data['_LOCALIZED_UID']; } $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($childTable); diff --git a/Classes/Hooks/PageLayoutViewDrawItem.php b/Classes/Hooks/PageLayoutViewDrawItem.php index ec2feeab..3bf5a447 100644 --- a/Classes/Hooks/PageLayoutViewDrawItem.php +++ b/Classes/Hooks/PageLayoutViewDrawItem.php @@ -98,7 +98,7 @@ public function preProcess( $this->extSettings = $this->settingsService->get(); // only render special backend preview if it is a mask element - if (substr($row['CType'], 0, 4) === "mask") { + if (substr($row['CType'], 0, 4) === 'mask') { $elementKey = substr($row['CType'], 5); # fallback to prevent breaking change @@ -120,25 +120,25 @@ public function preProcess( $view->setTemplatePathAndFilename($templatePathAndFilename); // if there are paths for layouts and partials set, add them to view - if (!empty($this->extSettings["layouts_backend"])) { - $layoutRootPath = MaskUtility::getFileAbsFileName($this->extSettings["layouts_backend"]); + if (!empty($this->extSettings['layouts_backend'])) { + $layoutRootPath = MaskUtility::getFileAbsFileName($this->extSettings['layouts_backend']); $view->setLayoutRootPaths(array($layoutRootPath)); } - if (!empty($this->extSettings["partials_backend"])) { - $partialRootPath = MaskUtility::getFileAbsFileName($this->extSettings["partials_backend"]); + if (!empty($this->extSettings['partials_backend'])) { + $partialRootPath = MaskUtility::getFileAbsFileName($this->extSettings['partials_backend']); $view->setPartialRootPaths(array($partialRootPath)); } // Fetch and assign some useful variables - $data = $this->getContentObject($row["uid"]); - $element = $this->storageRepository->loadElement("tt_content", $elementKey); - $view->assign("row", $row); - $view->assign("data", $data); + $data = $this->getContentObject($row['uid']); + $element = $this->storageRepository->loadElement('tt_content', $elementKey); + $view->assign('row', $row); + $view->assign('data', $data); // if the elementLabel contains LLL: then translate it - $elementLabel = $element["label"]; + $elementLabel = $element['label']; if (GeneralUtility::isFirstPartOfStr($elementLabel, 'LLL:')) { - $elementLabel = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate($elementLabel, "mask"); + $elementLabel = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate($elementLabel, 'mask'); } // Render everything diff --git a/Classes/Imaging/IconProvider/ContentElementIconProvider.php b/Classes/Imaging/IconProvider/ContentElementIconProvider.php index f2d36d3b..d1ff7c1a 100644 --- a/Classes/Imaging/IconProvider/ContentElementIconProvider.php +++ b/Classes/Imaging/IconProvider/ContentElementIconProvider.php @@ -81,7 +81,7 @@ public function prepareIconMarkup(Icon $icon, array $options = array()) $this->storageRepository = $this->objectManager->get("MASK\Mask\Domain\Repository\StorageRepository"); $this->settingsService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Domain\\Service\\SettingsService'); $this->extSettings = $this->settingsService->get(); - $this->contentElement = $this->storageRepository->loadElement("tt_content", $options["contentElementKey"]); + $this->contentElement = $this->storageRepository->loadElement('tt_content', $options['contentElementKey']); $icon->setMarkup($this->generateMarkup($icon, $options)); } @@ -105,10 +105,10 @@ protected function generateMarkup(Icon $icon, array $options) $color = $this->getColor($this->contentElement); if ($color) { - $styles[] = "color: #" . $color; + $styles[] = 'color: #' . $color; } if (count($styles)) { - $markup = ''; } else { $markup = ''; @@ -116,15 +116,15 @@ protected function generateMarkup(Icon $icon, array $options) } else { if ($previewIconAvailable) { $markup = '' . $this->contentElement['; + '/')) . '" alt="' . $this->contentElement['label'] . '" title="' . $this->contentElement['label'] . '"/>'; } else { $color = $this->getColor($this->contentElement); if ($color) { - $styles[] = "background-color: #" . $color; + $styles[] = 'background-color: #' . $color; } - $styles[] = "color: #fff"; - $markup = '' . mb_substr($this->contentElement["label"], 0, 1) . ''; + $styles[] = 'color: #fff'; + $markup = '' . mb_substr($this->contentElement['label'], 0, 1) . ''; } } @@ -155,7 +155,7 @@ protected function isPreviewIconAvailable($key) */ protected function isFontAwesomeKeyAvailable($element) { - return trim($element["icon"]) != ""; + return trim($element['icon']) != ''; } /** @@ -165,7 +165,7 @@ protected function isFontAwesomeKeyAvailable($element) */ protected function getPreviewIconPath($key) { - return $this->extSettings["preview"] . $key . '.png'; + return $this->extSettings['preview'] . $key . '.png'; } /** @@ -176,7 +176,7 @@ protected function getPreviewIconPath($key) */ protected function getFontAwesomeKey($element) { - return trim(str_replace("fa-", "", $element["icon"])); + return trim(str_replace('fa-', '', $element['icon'])); } /** @@ -187,6 +187,6 @@ protected function getFontAwesomeKey($element) */ protected function getColor($element) { - return trim(str_replace("#", "", $element["color"])); + return trim(str_replace('#', '', $element['color'])); } } diff --git a/Classes/ItemsProcFuncs/CTypeList.php b/Classes/ItemsProcFuncs/CTypeList.php index 6ba9006e..2e1f2f70 100644 --- a/Classes/ItemsProcFuncs/CTypeList.php +++ b/Classes/ItemsProcFuncs/CTypeList.php @@ -47,21 +47,21 @@ class CTypeList extends AbstractList public function itemsProcFunc(&$params) { // if this tt_content element is inline element of mask - if ($params["row"]["colPos"] == $this->colPos) { + if ($params['row']['colPos'] == $this->colPos) { $fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); $this->storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Domain\\Repository\\StorageRepository'); - if (isset($_REQUEST["ajax"]["context"])) { - $ajaxContext = json_decode($_REQUEST["ajax"]["context"]); - $fieldKey = str_replace("_parent", "", $ajaxContext->config->foreign_field); + if (isset($_REQUEST['ajax']['context'])) { + $ajaxContext = json_decode($_REQUEST['ajax']['context']); + $fieldKey = str_replace('_parent', '', $ajaxContext->config->foreign_field); } else { - $fields = $params["row"]; + $fields = $params['row']; foreach ($fields as $key => $field) { // search for the parent field, to get the key of mask field this content element belongs to - if ($this->startsWith($key, "tx_mask_") && $this->endsWith($key, "_parent") && $field > 0) { + if ($this->startsWith($key, 'tx_mask_') && $this->endsWith($key, '_parent') && $field > 0) { // if a parent field was found, that is filled with a uid, extract the mask field name from it - $fieldKey = str_replace("_parent", "", $key); + $fieldKey = str_replace('_parent', '', $key); // if one parent field was found, don't continue search, there can only be one parent break; @@ -74,23 +74,23 @@ public function itemsProcFunc(&$params) $fieldConfiguration = $this->storageRepository->loadField($table, $fieldKey); // if there is a restriction of cTypes specified - if (is_array($fieldConfiguration["cTypes"])) { + if (is_array($fieldConfiguration['cTypes'])) { // prepare array of allowed cTypes, with cTypes as keys - $cTypes = array_flip($fieldConfiguration["cTypes"]); + $cTypes = array_flip($fieldConfiguration['cTypes']); // and check each item if it is allowed. if not, unset it - foreach ($params["items"] as $itemKey => $item) { + foreach ($params['items'] as $itemKey => $item) { if (!isset($cTypes[$item[1]])) { - unset($params["items"][$itemKey]); + unset($params['items'][$itemKey]); } } } } else { // if it is not inline tt_content element // and if other itemsProcFunc from other extension was available (e.g. gridelements), // then call it now and let it render the items - if (!empty($params["config"]["m_itemsProcFunc"])) { - \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($params["config"]["m_itemsProcFunc"], $params, + if (!empty($params['config']['m_itemsProcFunc'])) { + \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($params['config']['m_itemsProcFunc'], $params, $this); } } @@ -105,7 +105,7 @@ public function itemsProcFunc(&$params) protected function startsWith($haystack, $needle) { // search backwards starting from haystack length characters from the end - return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== false; + return $needle === '' || strrpos($haystack, $needle, -strlen($haystack)) !== false; } /** @@ -117,7 +117,7 @@ protected function startsWith($haystack, $needle) protected function endsWith($haystack, $needle) { // search forward starting from end minus needle length characters - return $needle === "" || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, + return $needle === '' || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== false); } } diff --git a/Classes/ItemsProcFuncs/ColPosList.php b/Classes/ItemsProcFuncs/ColPosList.php index 8296eb23..f8cec3e9 100644 --- a/Classes/ItemsProcFuncs/ColPosList.php +++ b/Classes/ItemsProcFuncs/ColPosList.php @@ -40,9 +40,9 @@ class ColPosList extends AbstractList public function itemsProcFunc(&$params) { // if this tt_content element is inline element of mask - if ($params["row"]["colPos"] == $this->colPos) { + if ($params['row']['colPos'] == $this->colPos) { // only allow mask nested element column - $params["items"] = array( + $params['items'] = array( array( \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('mask_content_colpos', 'mask'), $this->colPos, @@ -53,8 +53,8 @@ public function itemsProcFunc(&$params) } else { // if it is not inline tt_content element // and if other itemsProcFunc from other extension was available (e.g. gridelements), // then call it now and let it render the items - if (!empty($params["config"]["m_itemsProcFunc"])) { - \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($params["config"]["m_itemsProcFunc"], $params, + if (!empty($params['config']['m_itemsProcFunc'])) { + \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($params['config']['m_itemsProcFunc'], $params, $this); } } diff --git a/Classes/Utility/GeneralUtility.php b/Classes/Utility/GeneralUtility.php index fe8aa962..47696fcc 100755 --- a/Classes/Utility/GeneralUtility.php +++ b/Classes/Utility/GeneralUtility.php @@ -66,12 +66,12 @@ public function __construct(\MASK\Mask\Domain\Repository\StorageRepository $stor * @return boolean $evalValue is set * @author Benjamin Butschell */ - public function isEvalValueSet($fieldKey, $evalValue, $type = "tt_content") + public function isEvalValueSet($fieldKey, $evalValue, $type = 'tt_content') { $storage = $this->storageRepository->load(); $found = false; - if ($storage[$type]["tca"][$fieldKey]["config"]["eval"] != "") { - $evals = explode(",", $storage[$type]["tca"][$fieldKey]["config"]["eval"]); + if ($storage[$type]['tca'][$fieldKey]['config']['eval'] != '') { + $evals = explode(',', $storage[$type]['tca'][$fieldKey]['config']['eval']); foreach ($evals as $index => $eval) { $evals[$index] = strtolower($eval); } @@ -88,14 +88,14 @@ public function isEvalValueSet($fieldKey, $evalValue, $type = "tt_content") * @return string $rte_transform * @author Benjamin Butschell */ - public function getRteTransformMode($fieldKey, $type = "tt_content") + public function getRteTransformMode($fieldKey, $type = 'tt_content') { $storage = $this->storageRepository->load(); - $transformMode = ""; + $transformMode = ''; $matches = array(); - if ($storage[$type]["tca"][$fieldKey]["defaultExtras"] != "") { + if ($storage[$type]['tca'][$fieldKey]['defaultExtras'] != '') { $re = "/(rte_transform\\[([a-z=_]+)\\])/"; - preg_match($re, $storage[$type]["tca"][$fieldKey]["defaultExtras"], $matches); + preg_match($re, $storage[$type]['tca'][$fieldKey]['defaultExtras'], $matches); $transformMode = end($matches); } return $transformMode; @@ -178,7 +178,7 @@ public function isBlindLinkOptionSet($fieldKey, $evalValue, $type = 'tt_content' * @return array * @author Gernot Ploiner */ - public function replaceKey($data, $replace_key, $key = "--key--") + public function replaceKey($data, $replace_key, $key = '--key--') { foreach ($data as $elem_key => $elem) { if (is_array($elem)) { @@ -201,14 +201,14 @@ public function getFirstNoneTabField($fields) { if (count($fields)) { $potentialFirst = $fields[0]; - if (strpos($potentialFirst, "--div--") !== false) { + if (strpos($potentialFirst, '--div--') !== false) { unset($fields[0]); return $this->getFirstNoneTabField($fields); } else { return $potentialFirst; } } else { - return ""; + return ''; } } diff --git a/Classes/ViewHelpers/CTypesViewHelper.php b/Classes/ViewHelpers/CTypesViewHelper.php index 8419c157..27a42ffa 100644 --- a/Classes/ViewHelpers/CTypesViewHelper.php +++ b/Classes/ViewHelpers/CTypesViewHelper.php @@ -29,12 +29,12 @@ public function render() $cTypes = $GLOBALS['TCA']['tt_content']['columns']['CType']['config']['items']; if ($cTypes) { foreach ($cTypes as $type) { - if ($type[1] !== "--div--") { + if ($type[1] !== '--div--') { if (\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($type[0], 'LLL:')) { $items[$type[1]] = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate($type[0], - "mask") . " (" . $type[1] . ")"; + 'mask') . ' (' . $type[1] . ')'; } else { - $items[$type[1]] = $type[0] . " (" . $type[1] . ")"; + $items[$type[1]] = $type[0] . ' (' . $type[1] . ')'; } } } diff --git a/Classes/ViewHelpers/EvalViewHelper.php b/Classes/ViewHelpers/EvalViewHelper.php index 47063d68..4ac561e6 100644 --- a/Classes/ViewHelpers/EvalViewHelper.php +++ b/Classes/ViewHelpers/EvalViewHelper.php @@ -57,9 +57,9 @@ public function render() $this->fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); if ($field) { - if ($field["inlineParent"]) { - $type = $field["inlineParent"]; - $fieldKey = "tx_mask_" . $field["key"]; + if ($field['inlineParent']) { + $type = $field['inlineParent']; + $fieldKey = 'tx_mask_' . $field['key']; } else { $type = $this->fieldHelper->getFieldType($fieldKey, $elementKey, true); } diff --git a/Classes/ViewHelpers/ItemsViewHelper.php b/Classes/ViewHelpers/ItemsViewHelper.php index 44d532ed..5c6c2a3f 100644 --- a/Classes/ViewHelpers/ItemsViewHelper.php +++ b/Classes/ViewHelpers/ItemsViewHelper.php @@ -31,7 +31,7 @@ public function render() if ($this->arguments['items']) { foreach ($this->arguments['items'] as $item) { - $itemArray[] = implode(",", $item); + $itemArray[] = implode(',', $item); } } diff --git a/Classes/ViewHelpers/JsOpenParamsViewHelper.php b/Classes/ViewHelpers/JsOpenParamsViewHelper.php index 4e9e3b2b..c37b7f29 100644 --- a/Classes/ViewHelpers/JsOpenParamsViewHelper.php +++ b/Classes/ViewHelpers/JsOpenParamsViewHelper.php @@ -57,9 +57,9 @@ public function render() $this->fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); if ($field) { - if ($field["inlineParent"]) { - $type = $field["inlineParent"]; - $fieldKey = "tx_mask_" . $field["key"]; + if ($field['inlineParent']) { + $type = $field['inlineParent']; + $fieldKey = 'tx_mask_' . $field['key']; } else { $type = $this->fieldHelper->getFieldType($fieldKey, $elementKey, true); } diff --git a/Classes/ViewHelpers/LabelViewHelper.php b/Classes/ViewHelpers/LabelViewHelper.php index 68114447..6269389d 100644 --- a/Classes/ViewHelpers/LabelViewHelper.php +++ b/Classes/ViewHelpers/LabelViewHelper.php @@ -46,9 +46,9 @@ public function render(): string // if we have the whole field configuration if ($field) { // check if this field is in an repeating field - if ($field["inlineParent"]) { + if ($field['inlineParent']) { // if yes, the label is in the configuration - $label = $field["label"]; + $label = $field['label']; } else { // otherwise the type can only be tt_content or pages if ($table) { diff --git a/Classes/ViewHelpers/RteTransformViewHelper.php b/Classes/ViewHelpers/RteTransformViewHelper.php index 4e447e81..66b74d2c 100644 --- a/Classes/ViewHelpers/RteTransformViewHelper.php +++ b/Classes/ViewHelpers/RteTransformViewHelper.php @@ -55,9 +55,9 @@ public function render() $this->fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); if ($field) { - if ($field["inlineParent"]) { - $type = $field["inlineParent"]; - $fieldKey = "tx_mask_" . $field["key"]; + if ($field['inlineParent']) { + $type = $field['inlineParent']; + $fieldKey = 'tx_mask_' . $field['key']; } else { $type = $this->fieldHelper->getFieldType($fieldKey, $elementKey, true); } diff --git a/Configuration/TCA/Overrides/pages.php b/Configuration/TCA/Overrides/pages.php index 52b13837..3b14c6ec 100644 --- a/Configuration/TCA/Overrides/pages.php +++ b/Configuration/TCA/Overrides/pages.php @@ -8,9 +8,9 @@ $tcaCodeGenerator = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\CodeGenerator\\TcaCodeGenerator'); // Generate TCA for Pages - $pagesColumns = $tcaCodeGenerator->generateFieldsTca($configuration["pages"]["tca"]); + $pagesColumns = $tcaCodeGenerator->generateFieldsTca($configuration['pages']['tca']); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('pages', $pagesColumns); - $tcaCodeGenerator->setPageTca($configuration["pages"]["tca"]); + $tcaCodeGenerator->setPageTca($configuration['pages']['tca']); // Generate TCA for Inline-Fields $tcaCodeGenerator->setInlineTca($configuration); diff --git a/Configuration/TCA/Overrides/tt_content.php b/Configuration/TCA/Overrides/tt_content.php index 32c1c821..6f98efb3 100644 --- a/Configuration/TCA/Overrides/tt_content.php +++ b/Configuration/TCA/Overrides/tt_content.php @@ -19,9 +19,9 @@ $tcaCodeGenerator = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\CodeGenerator\\TcaCodeGenerator'); // Generate TCA for Content-Elements - $contentColumns = $tcaCodeGenerator->generateFieldsTca($configuration["tt_content"]["tca"]); + $contentColumns = $tcaCodeGenerator->generateFieldsTca($configuration['tt_content']['tca']); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_content', $contentColumns); - $tcaCodeGenerator->setElementsTca($configuration["tt_content"]["elements"]); + $tcaCodeGenerator->setElementsTca($configuration['tt_content']['elements']); } if (!empty($configuration)) { diff --git a/ext_emconf.php b/ext_emconf.php index 3742f488..aadbbee1 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -32,7 +32,7 @@ [ 'psr-4' => [ - "MASK\\Mask\\" => "Classes/" + "MASK\\Mask\\" => 'Classes/' ] ] ]; diff --git a/ext_localconf.php b/ext_localconf.php index 62a9d2ec..39ed0ab9 100755 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -15,21 +15,21 @@ // Register Icons needed in the backend module $iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance("TYPO3\CMS\Core\Imaging\IconRegistry"); $maskIcons = array( - "Check", - "Date", - "Datetime", - "File", - "Float", - "Inline", - "Integer", - "Link", - "Radio", - "Richtext", - "Select", - "String", - "Tab", - "Text", - "Content" + 'Check', + 'Date', + 'Datetime', + 'File', + 'Float', + 'Inline', + 'Integer', + 'Link', + 'Radio', + 'Richtext', + 'Select', + 'String', + 'Tab', + 'Text', + 'Content' ); foreach ($maskIcons as $maskIcon) { $iconRegistry->registerIcon( @@ -55,18 +55,18 @@ function user_mask_beLayout($layout = null) { // get current page uid: - if (is_array($_REQUEST["data"]["pages"])) { // after saving page - $uid = intval(key($_REQUEST["data"]["pages"])); - } elseif ($GLOBALS["SOBE"]->editconf["pages"]) { // after opening pages - $uid = intval(key($GLOBALS["SOBE"]->editconf["pages"])); + if (is_array($_REQUEST['data']['pages'])) { // after saving page + $uid = intval(key($_REQUEST['data']['pages'])); + } elseif ($GLOBALS['SOBE']->editconf['pages']) { // after opening pages + $uid = intval(key($GLOBALS['SOBE']->editconf['pages'])); } else { - if ($GLOBALS["_SERVER"]["HTTP_REFERER"] != "") { - $url = $GLOBALS["_SERVER"]["HTTP_REFERER"]; + if ($GLOBALS['_SERVER']['HTTP_REFERER'] != '') { + $url = $GLOBALS['_SERVER']['HTTP_REFERER']; $queryString = parse_url($url, PHP_URL_QUERY); $result = array(); parse_str($queryString, $result); - if ($result["id"]) { - $uid = (int)$result["id"]; + if ($result['id']) { + $uid = (int)$result['id']; } } } @@ -84,19 +84,19 @@ function user_mask_beLayout($layout = null) ->execute() ->fetch(\Doctrine\DBAL\FetchMode::ASSOCIATIVE); - $backend_layout = $data["backend_layout"]; - $backend_layout_next_level = $data["backend_layout_next_level"]; + $backend_layout = $data['backend_layout']; + $backend_layout_next_level = $data['backend_layout_next_level']; - if ($backend_layout !== "") { // If backend_layout is set on current page + if ($backend_layout !== '') { // If backend_layout is set on current page if (in_array($backend_layout, - [$layout, "pagets__" . $layout])) { // Check backend_layout of current page + [$layout, 'pagets__' . $layout])) { // Check backend_layout of current page return true; } else { return false; } - } elseif ($backend_layout_next_level !== "") { // If backend_layout_next_level is set on current page + } elseif ($backend_layout_next_level !== '') { // If backend_layout_next_level is set on current page if (in_array($backend_layout_next_level, - [$layout, "pagets__" . $layout])) { // Check backend_layout_next_level of current page + [$layout, 'pagets__' . $layout])) { // Check backend_layout_next_level of current page return true; } else { return false; @@ -110,7 +110,7 @@ function user_mask_beLayout($layout = null) $rootline = []; } foreach ($rootline as $page) { - if (in_array($page["backend_layout_next_level"], [$layout, "pagets__" . $layout])) { + if (in_array($page['backend_layout_next_level'], [$layout, 'pagets__' . $layout])) { return true; } } @@ -124,15 +124,15 @@ function user_mask_beLayout($layout = null) // set root line fields if ($json['pages']['tca']) { - $rootlineFields = explode(",", $GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields']); + $rootlineFields = explode(',', $GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields']); foreach ($json['pages']['tca'] as $fieldKey => $value) { - $formType = $fieldHelper->getFormType($fieldKey, "", "pages"); - if ($formType !== "Tab") { + $formType = $fieldHelper->getFormType($fieldKey, '', 'pages'); + if ($formType !== 'Tab') { // Add addRootLineFields for all page fields $rootlineFields[] = $fieldKey; } } - $GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields'] = implode(",", $rootlineFields); + $GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields'] = implode(',', $rootlineFields); } // SQL inject: From 58773e4497d9a74a8cefbd0ece10904cfa197caf Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Thu, 12 Mar 2020 17:36:36 +0100 Subject: [PATCH 34/93] [BUGFIX] replacing deprecated BackendUtility::getModuleUrl --- Classes/Hooks/PageLayoutViewDrawItem.php | 8 ++++++-- Classes/ViewHelpers/ConfigureExtensionViewHelper.php | 12 ++++++++---- Classes/ViewHelpers/EditLinkViewHelper.php | 9 +++++---- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/Classes/Hooks/PageLayoutViewDrawItem.php b/Classes/Hooks/PageLayoutViewDrawItem.php index 3bf5a447..5c5172fc 100644 --- a/Classes/Hooks/PageLayoutViewDrawItem.php +++ b/Classes/Hooks/PageLayoutViewDrawItem.php @@ -33,6 +33,7 @@ use MASK\Mask\Domain\Service\SettingsService; use MASK\Mask\Helper\InlineHelper; use MASK\Mask\Utility\GeneralUtility as MaskUtility; +use TYPO3\CMS\Backend\Routing\UriBuilder; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Object\ObjectManager; @@ -86,6 +87,8 @@ class PageLayoutViewDrawItem implements \TYPO3\CMS\Backend\View\PageLayoutViewDr * @param string $itemContent Item content * @param array $row Record row of tt_content * @return void + * @throws \TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException + * @throws \TYPO3\CMS\Extbase\Object\Exception */ public function preProcess( \TYPO3\CMS\Backend\View\PageLayoutView &$parentObject, @@ -151,8 +154,9 @@ public function preProcess( ], 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') ]; - $editElementUrl = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('record_edit', - $editElementUrlParameters); + + $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); + $editElementUrl = $uriBuilder->buildUriFromRoute('record_edit', $editElementUrlParameters); $headerContent = '' . $elementLabel . '
      '; $itemContent .= '
      '; $itemContent .= $content; diff --git a/Classes/ViewHelpers/ConfigureExtensionViewHelper.php b/Classes/ViewHelpers/ConfigureExtensionViewHelper.php index 07f2f17e..c4ab67eb 100644 --- a/Classes/ViewHelpers/ConfigureExtensionViewHelper.php +++ b/Classes/ViewHelpers/ConfigureExtensionViewHelper.php @@ -2,7 +2,9 @@ namespace MASK\Mask\ViewHelpers; -use TYPO3\CMS\Backend\Utility\BackendUtility; +use TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException; +use TYPO3\CMS\Backend\Routing\UriBuilder; +use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; /** @@ -25,11 +27,13 @@ class ConfigureExtensionViewHelper extends AbstractViewHelper /** * Renders link tag to extension manager configuration + * @throws RouteNotFoundException * @author Benjamin Butschell bb@webprofil.at> */ - public function render() + public function render(): string { - $url = BackendUtility::getModuleUrl('tools_toolssettings'); - return '' . $this->renderChildren() . ''; + $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); + $url = $uriBuilder->buildUriFromRoute('tools_toolssettings'); + return '' . $this->renderChildren() . ''; } } diff --git a/Classes/ViewHelpers/EditLinkViewHelper.php b/Classes/ViewHelpers/EditLinkViewHelper.php index 433b8dd7..13f9cd36 100644 --- a/Classes/ViewHelpers/EditLinkViewHelper.php +++ b/Classes/ViewHelpers/EditLinkViewHelper.php @@ -2,7 +2,8 @@ namespace MASK\Mask\ViewHelpers; -use TYPO3\CMS\Backend\Utility\BackendUtility; +use TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException; +use TYPO3\CMS\Backend\Routing\UriBuilder; use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper; @@ -34,8 +35,8 @@ public function initializeArguments() /** * returning a EditLink-Tag for TYPO3 Backend - * @param array $element * @return mixed + * @throws RouteNotFoundException */ public function render() { @@ -50,8 +51,8 @@ public function render() ], 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') ]; - $uri = BackendUtility::getModuleUrl('record_edit', $urlParameters); - + $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); + $uri = $uriBuilder->buildUriFromRoute('record_edit', $urlParameters); $this->tag->addAttribute('href', $uri); } From 08e9e9ad2f83f2658a0bdf969af48838d82298d7 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Thu, 12 Mar 2020 17:38:49 +0100 Subject: [PATCH 35/93] [TASK] declaring strict types --- Classes/Backend/BackendLayoutView.php | 1 + Classes/CodeGenerator/AbstractCodeGenerator.php | 1 + Classes/CodeGenerator/JsonCodeGenerator.php | 1 + Classes/CodeGenerator/SqlCodeGenerator.php | 1 + Classes/CodeGenerator/TyposcriptCodeGenerator.php | 1 + Classes/Controller/WizardContentController.php | 1 + Classes/DataProcessing/MaskProcessor.php | 1 + Classes/Domain/Model/BackendLayout.php | 1 + Classes/Domain/Model/Content.php | 1 + Classes/Domain/Model/Page.php | 1 + Classes/Domain/Repository/ContentRepository.php | 1 + Classes/Domain/Repository/IconRepository.php | 1 + Classes/Domain/Repository/PageRepository.php | 1 + Classes/Domain/Repository/StorageRepository.php | 1 + Classes/Domain/Service/SettingsService.php | 1 + Classes/Fluid/FluidTemplateContentObject.php | 1 + Classes/Helper/FieldHelper.php | 1 + Classes/Helper/InlineHelper.php | 1 + Classes/Hooks/PageLayoutViewDrawItem.php | 1 + Classes/Hooks/PageLayoutViewHook.php | 1 + Classes/Imaging/IconProvider/ContentElementIconProvider.php | 1 + Classes/ItemsProcFuncs/AbstractList.php | 1 + Classes/ItemsProcFuncs/CTypeList.php | 1 + Classes/ItemsProcFuncs/ColPosList.php | 1 + Classes/Utility/GeneralUtility.php | 1 + Classes/ViewHelpers/CTypesViewHelper.php | 1 + Classes/ViewHelpers/ConfigureExtensionViewHelper.php | 1 + Classes/ViewHelpers/ContentViewHelper.php | 1 + Classes/ViewHelpers/EditLinkViewHelper.php | 1 + Classes/ViewHelpers/ElementCountViewHelper.php | 1 + Classes/ViewHelpers/EvalViewHelper.php | 1 + Classes/ViewHelpers/FormTypeViewHelper.php | 1 + Classes/ViewHelpers/ItemsViewHelper.php | 1 + Classes/ViewHelpers/JsOpenParamsViewHelper.php | 1 + Classes/ViewHelpers/LabelViewHelper.php | 1 + Classes/ViewHelpers/LinkViewHelper.php | 1 + Classes/ViewHelpers/LinkoptionViewHelper.php | 1 + Classes/ViewHelpers/MultiuseViewHelper.php | 1 + Classes/ViewHelpers/RteTransformViewHelper.php | 1 + Classes/ViewHelpers/ShuttleViewHelper.php | 1 + Classes/ViewHelpers/SubstrViewHelper.php | 1 + Classes/ViewHelpers/TcaViewHelper.php | 1 + Classes/ViewHelpers/TranslateLabelViewHelper.php | 1 + Configuration/Backend/AjaxRoutes.php | 1 + Configuration/ExpressionLanguage.php | 1 + Configuration/TCA/Overrides/pages.php | 1 + 46 files changed, 46 insertions(+) diff --git a/Classes/Backend/BackendLayoutView.php b/Classes/Backend/BackendLayoutView.php index 44244a67..716c2125 100644 --- a/Classes/Backend/BackendLayoutView.php +++ b/Classes/Backend/BackendLayoutView.php @@ -1,4 +1,5 @@ [ diff --git a/Configuration/ExpressionLanguage.php b/Configuration/ExpressionLanguage.php index 932672bb..60f93d6f 100644 --- a/Configuration/ExpressionLanguage.php +++ b/Configuration/ExpressionLanguage.php @@ -1,4 +1,5 @@ load(); From d3a3ea7ed3ed764813aa219b764bc506542d7871 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Thu, 12 Mar 2020 19:09:03 +0100 Subject: [PATCH 36/93] [TASK] adding return types, class use statements, strict type comparisons --- Classes/Backend/BackendLayoutView.php | 7 +- .../CodeGenerator/AbstractCodeGenerator.php | 11 +- Classes/CodeGenerator/HtmlCodeGenerator.php | 27 ++-- Classes/CodeGenerator/JsonCodeGenerator.php | 2 +- Classes/CodeGenerator/SqlCodeGenerator.php | 66 +++++---- Classes/CodeGenerator/TcaCodeGenerator.php | 132 ++++++++++-------- .../CodeGenerator/TyposcriptCodeGenerator.php | 15 +- .../Controller/WizardContentController.php | 52 +++---- Classes/Controller/WizardController.php | 90 +++++++----- Classes/Controller/WizardPageController.php | 37 +++-- Classes/DataProcessing/MaskProcessor.php | 7 +- Classes/Domain/Model/BackendLayout.php | 22 +-- Classes/Domain/Model/Content.php | 30 ++-- Classes/Domain/Model/Page.php | 27 ++-- .../Repository/BackendLayoutRepository.php | 66 +++++---- .../Domain/Repository/ContentRepository.php | 11 +- Classes/Domain/Repository/IconRepository.php | 3 +- Classes/Domain/Repository/PageRepository.php | 4 +- .../Domain/Repository/StorageRepository.php | 131 +++++++++-------- Classes/Domain/Service/SettingsService.php | 18 +-- ...kContentTypeConditionFunctionsProvider.php | 3 +- Classes/Fluid/FluidTemplateContentObject.php | 10 +- Classes/Helper/FieldHelper.php | 69 +++++---- Classes/Helper/InlineHelper.php | 74 +++++----- Classes/Hooks/PageLayoutViewDrawItem.php | 32 +++-- Classes/Hooks/PageLayoutViewHook.php | 2 +- .../ContentElementIconProvider.php | 51 ++++--- Classes/ItemsProcFuncs/CTypeList.php | 26 ++-- Classes/ItemsProcFuncs/ColPosList.php | 19 ++- Classes/Utility/GeneralUtility.php | 74 +++++----- Classes/ViewHelpers/CTypesViewHelper.php | 11 +- Classes/ViewHelpers/ContentViewHelper.php | 13 +- Classes/ViewHelpers/EditLinkViewHelper.php | 4 +- .../ViewHelpers/ElementCountViewHelper.php | 10 +- Classes/ViewHelpers/EvalViewHelper.php | 14 +- Classes/ViewHelpers/FormTypeViewHelper.php | 13 +- Classes/ViewHelpers/ItemsViewHelper.php | 4 +- .../ViewHelpers/JsOpenParamsViewHelper.php | 16 ++- Classes/ViewHelpers/LabelViewHelper.php | 8 +- Classes/ViewHelpers/LinkViewHelper.php | 16 +-- Classes/ViewHelpers/LinkoptionViewHelper.php | 17 ++- Classes/ViewHelpers/MultiuseViewHelper.php | 10 +- .../ViewHelpers/RteTransformViewHelper.php | 12 +- Classes/ViewHelpers/ShuttleViewHelper.php | 4 +- Classes/ViewHelpers/SubstrViewHelper.php | 6 +- Classes/ViewHelpers/TcaViewHelper.php | 8 +- .../ViewHelpers/TranslateLabelViewHelper.php | 7 +- Configuration/TCA/Overrides/pages.php | 4 +- Configuration/TCA/Overrides/tt_content.php | 6 +- composer.json | 3 +- ext_localconf.php | 40 +++--- ext_tables.php | 4 +- 52 files changed, 744 insertions(+), 604 deletions(-) diff --git a/Classes/Backend/BackendLayoutView.php b/Classes/Backend/BackendLayoutView.php index 716c2125..87afde2b 100644 --- a/Classes/Backend/BackendLayoutView.php +++ b/Classes/Backend/BackendLayoutView.php @@ -16,13 +16,18 @@ * The TYPO3 project - inspiring people to share! */ +use TYPO3\CMS\Backend\View\BackendLayout\DataProviderContext; + /** * Backend layout for CMS */ class BackendLayoutView extends \TYPO3\CMS\Backend\View\BackendLayoutView { - public function createDataProviderContext() + /** + * @return DataProviderContext + */ + public function createDataProviderContext(): DataProviderContext { return parent::createDataProviderContext(); } diff --git a/Classes/CodeGenerator/AbstractCodeGenerator.php b/Classes/CodeGenerator/AbstractCodeGenerator.php index cef2465b..216ca526 100644 --- a/Classes/CodeGenerator/AbstractCodeGenerator.php +++ b/Classes/CodeGenerator/AbstractCodeGenerator.php @@ -27,6 +27,9 @@ * This copyright notice MUST APPEAR in all copies of the script! * ************************************************************* */ +use MASK\Mask\Domain\Repository\StorageRepository; +use TYPO3\CMS\Core\Utility\GeneralUtility; + /** * Abstract base class for all the other code generators * @@ -38,17 +41,17 @@ abstract class AbstractCodeGenerator /** * StorageRepository * - * @var \MASK\Mask\Domain\Repository\StorageRepository + * @var StorageRepository */ protected $storageRepository; /** - * @param \MASK\Mask\Domain\Repository\StorageRepository $storageRepository + * @param StorageRepository $storageRepository */ - public function __construct(\MASK\Mask\Domain\Repository\StorageRepository $storageRepository = null) + public function __construct(StorageRepository $storageRepository = null) { if (!$storageRepository) { - $this->storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Domain\\Repository\\StorageRepository'); + $this->storageRepository = GeneralUtility::makeInstance(StorageRepository::class); } else { $this->storageRepository = $storageRepository; } diff --git a/Classes/CodeGenerator/HtmlCodeGenerator.php b/Classes/CodeGenerator/HtmlCodeGenerator.php index ad8a1399..1b2f0d33 100644 --- a/Classes/CodeGenerator/HtmlCodeGenerator.php +++ b/Classes/CodeGenerator/HtmlCodeGenerator.php @@ -24,12 +24,15 @@ * This copyright notice MUST APPEAR in all copies of the script! * ************************************************************* */ +use MASK\Mask\Helper\FieldHelper; +use TYPO3\CMS\Core\Utility\GeneralUtility; + /** * Generates the html and fluid for mask content elements * * @author Benjamin Butschell */ -class HtmlCodeGenerator extends \MASK\Mask\CodeGenerator\AbstractCodeGenerator +class HtmlCodeGenerator extends AbstractCodeGenerator { /** @@ -41,7 +44,7 @@ class HtmlCodeGenerator extends \MASK\Mask\CodeGenerator\AbstractCodeGenerator * @author Gernot Ploiner * */ - public function generateHtml($key, $table) + public function generateHtml($key, $table): string { $storage = $this->storageRepository->loadElement($table, $key); $html = ''; @@ -63,10 +66,10 @@ public function generateHtml($key, $table) * @author Gernot Ploiner * @author Benjamin Butschell */ - protected function generateFieldHtml($fieldKey, $elementKey, $table, $datafield = 'data') + protected function generateFieldHtml($fieldKey, $elementKey, $table, $datafield = 'data'): string { $html = ''; - $fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); + $fieldHelper = GeneralUtility::makeInstance(FieldHelper::class); switch ($fieldHelper->getFormType($fieldKey, $elementKey, $table)) { case 'Check': $html .= '{f:if(condition: ' . $datafield . '.' . $fieldKey . ", then: 'On', else: 'Off')}
      \n\n"; @@ -116,6 +119,7 @@ protected function generateFieldHtml($fieldKey, $elementKey, $table, $datafield $html .= "
    \n"; $html .= "\n\n"; break; + case 'String': case 'Integer': $html .= '' . "\n"; $html .= '{' . $datafield . '.' . $fieldKey . '}
    ' . "\n"; @@ -126,6 +130,7 @@ protected function generateFieldHtml($fieldKey, $elementKey, $table, $datafield $html .= '{' . $datafield . '.' . $fieldKey . '}
    ' . "\n"; $html .= "
    \n\n"; break; + case 'Select': case 'Radio': $html .= '' . "\n"; $html .= ' @@ -140,20 +145,6 @@ protected function generateFieldHtml($fieldKey, $elementKey, $table, $datafield $html .= '{' . $datafield . '.' . $fieldKey . '}
    ' . "\n"; $html .= "
    \n\n"; break; - case 'Select': - $html .= '' . "\n"; - $html .= ' - Value is: 1 - Value is: 2 - Value is: 3 -
    ' . "\n"; - $html .= "
    \n\n"; - break; - case 'String': - $html .= '' . "\n"; - $html .= '{' . $datafield . '.' . $fieldKey . '}
    ' . "\n"; - $html .= "
    \n\n"; - break; case 'Text': $html .= '' . "\n"; $html .= '{' . $datafield . '.' . $fieldKey . '}
    ' . "\n"; diff --git a/Classes/CodeGenerator/JsonCodeGenerator.php b/Classes/CodeGenerator/JsonCodeGenerator.php index de141bd5..4e3641d4 100644 --- a/Classes/CodeGenerator/JsonCodeGenerator.php +++ b/Classes/CodeGenerator/JsonCodeGenerator.php @@ -33,7 +33,7 @@ * * @author Benjamin Butschell */ -class JsonCodeGenerator extends \MASK\Mask\CodeGenerator\AbstractCodeGenerator +class JsonCodeGenerator extends AbstractCodeGenerator { //put your code here } diff --git a/Classes/CodeGenerator/SqlCodeGenerator.php b/Classes/CodeGenerator/SqlCodeGenerator.php index 2aa0ee5b..f94d47e1 100644 --- a/Classes/CodeGenerator/SqlCodeGenerator.php +++ b/Classes/CodeGenerator/SqlCodeGenerator.php @@ -28,35 +28,34 @@ * ************************************************************* */ use Doctrine\DBAL\DBALException; +use Doctrine\DBAL\Schema\SchemaException; use TYPO3\CMS\Core\Database\ConnectionPool; +use TYPO3\CMS\Core\Database\Schema\Exception\StatementException; +use TYPO3\CMS\Core\Database\Schema\Exception\UnexpectedSignalReturnValueTypeException; use TYPO3\CMS\Core\Database\Schema\SchemaMigrator; -use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Extbase\Object\ObjectManager; -use TYPO3\CMS\Extbase\Utility\DebuggerUtility; +use MASK\Mask\Domain\Repository\StorageRepository; +use MASK\Mask\Helper\FieldHelper; /** * Generates all the sql needed for mask content elements * * @author Benjamin Butschell */ -class SqlCodeGenerator extends \MASK\Mask\CodeGenerator\AbstractCodeGenerator +class SqlCodeGenerator extends AbstractCodeGenerator { /** * Performs updates, adjusted function from extension_builder * - * @param array $params - * @param string[] $sql + * @param array $sqlStatements * @return array * @throws DBALException - * @throws \Doctrine\DBAL\Schema\SchemaException - * @throws \TYPO3\CMS\Core\Database\Schema\Exception\StatementException - * @throws \TYPO3\CMS\Core\Database\Schema\Exception\UnexpectedSignalReturnValueTypeException - * @throws \TYPO3\CMS\Extbase\SignalSlot\Exception\InvalidSlotException - * @throws \TYPO3\CMS\Extbase\SignalSlot\Exception\InvalidSlotReturnException + * @throws SchemaException + * @throws StatementException + * @throws UnexpectedSignalReturnValueTypeException */ - protected function performDbUpdates(array $sqlStatements) + protected function performDbUpdates(array $sqlStatements): array { /** @var ConnectionPool $connectionPool */ $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class); @@ -73,14 +72,15 @@ protected function performDbUpdates(array $sqlStatements) $connection->exec($statement); } catch (DBALException $exception) { $hasErrors = true; - GeneralUtility::devlog( - 'SQL error', - 'mask', - 0, - [ - 'statement' => $statement, - 'error' => $exception->getMessage() - ]); + //@todo +// GeneralUtility::devlog( +// 'SQL error', +// 'mask', +// 0, +// [ +// 'statement' => $statement, +// 'error' => $exception->getMessage() +// ]); } } } @@ -99,30 +99,34 @@ protected function performDbUpdates(array $sqlStatements) * Updates the database if necessary * * @return array + * @throws DBALException + * @throws SchemaException + * @throws StatementException + * @throws UnexpectedSignalReturnValueTypeException * @author Benjamin Butschell */ - public function updateDatabase() + public function updateDatabase(): array { - $storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Domain\\Repository\\StorageRepository'); + $storageRepository = GeneralUtility::makeInstance(StorageRepository::class); $json = $storageRepository->load(); $sqlStatements = $this->getSqlByConfiguration($json); if (count($sqlStatements) > 0) { - $response = $this->performDbUpdates($sqlStatements); + return $this->performDbUpdates($sqlStatements); } - return $response; + return []; } /** * returns sql statements of all elements and pages and irre * @param array $json - * @return string + * @return array */ - public function getSqlByConfiguration($json) + public function getSqlByConfiguration($json): array { $sql_content = array(); $types = array_keys($json); $nonIrreTables = array('pages', 'tt_content'); - $fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); + $fieldHelper = GeneralUtility::makeInstance(FieldHelper::class); // Generate SQL-Statements if ($types) { @@ -130,7 +134,7 @@ public function getSqlByConfiguration($json) if ($json[$type]['sql']) { // If type/table is an irre table, then create table for it - if (array_search($type, $nonIrreTables) === false) { + if (!in_array($type, $nonIrreTables, true)) { $sql_content[] = 'CREATE TABLE ' . $type . " ( uid int(11) NOT NULL auto_increment, @@ -180,7 +184,7 @@ public function getSqlByConfiguration($json) // if this field is a content field, also add parent columns $fieldType = $fieldHelper->getFormType($field, '', $table); - if ($fieldType == 'Content') { + if ($fieldType === 'Content') { $sql_content[] = "CREATE TABLE tt_content (\n\t" . $field . '_parent' . ' ' . $definition . ",\n\t" . 'KEY ' . $field . ' (' . $field . '_parent,pid,deleted)' . "\n);\n"; } } @@ -202,9 +206,9 @@ public function getSqlByConfiguration($json) * @param array $sqlString * @return array */ - public function addDatabaseTablesDefinition(array $sqlString) + public function addDatabaseTablesDefinition(array $sqlString): array { - $storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Domain\\Repository\\StorageRepository'); + $storageRepository = GeneralUtility::makeInstance(StorageRepository::class); $json = $storageRepository->load(); $sql = $this->getSqlByConfiguration($json); $mergedSqlString = array_merge($sqlString, $sql); diff --git a/Classes/CodeGenerator/TcaCodeGenerator.php b/Classes/CodeGenerator/TcaCodeGenerator.php index e5f8e5a3..6ca3477d 100644 --- a/Classes/CodeGenerator/TcaCodeGenerator.php +++ b/Classes/CodeGenerator/TcaCodeGenerator.php @@ -1,4 +1,7 @@ - + * @noinspection PhpUnused */ - public function setInlineTca($json) + public function setInlineTca($json): void { // Generate TCA for IRRE Fields and Tables $notIrreTables = array('pages', 'tt_content', 'sys_file_reference'); if ($json) { foreach ($json as $table => $subJson) { - $fieldTCA = array(); - if (array_search($table, $notIrreTables) === false) { + if (!in_array($table, $notIrreTables, true)) { // Generate Table TCA $this->generateTableTca($table, $subJson['tca']); // Generate Field TCA $fieldTCA = $this->generateFieldsTca($subJson['tca']); - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns($table, $fieldTCA); + ExtensionManagementUtility::addTCAcolumns($table, $fieldTCA); // set label for inline if (!empty($json['tt_content']['tca'][$table]['inlineLabel'])) { $fields = array_keys($subJson['tca']); - if (array_search($json['tt_content']['tca'][$table]['inlineLabel'], $fields) !== false) { + if (in_array($json['tt_content']['tca'][$table]['inlineLabel'], $fields, true)) { $GLOBALS['TCA'][$table]['ctrl']['label'] = $json['tt_content']['tca'][$table]['inlineLabel']; } } @@ -77,16 +86,17 @@ public function setInlineTca($json) * * @param array $tca * @author Benjamin Butschell + * @noinspection PhpUnused */ - public function setElementsTca($tca) + public function setElementsTca($tca): void { - $fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); + $fieldHelper = GeneralUtility::makeInstance(FieldHelper::class); $defaultTabs = ',--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance,--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.frames;frames,--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.appearanceLinks;appearanceLinks,--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language,--palette--;;language,--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,--palette--;;hidden,--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.access;access,--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:categories,--div--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_category.tabs.category,categories,--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:notes,rowDescription,--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:extended'; // add gridelements fields, to make mask work with gridelements out of the box $gridelements = ''; - if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('gridelements')) { + if (ExtensionManagementUtility::isLoaded('gridelements')) { $gridelements = ', tx_gridelements_container, tx_gridelements_columns'; } if ($tca) { @@ -102,10 +112,10 @@ public function setElementsTca($tca) $prependTabs = '--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general,'; $fieldArray = array(); - $label = $elementvalue['shortLabel'] ? $elementvalue['shortLabel'] : $elementvalue['label']; // Optional shortLabel + $label = $elementvalue['shortLabel'] ?: $elementvalue['label']; // Optional shortLabel // add new entry in CType selectbox - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPlugin(array( + ExtensionManagementUtility::addPlugin(array( $label, 'mask_' . $elementvalue['key'], 'mask-ce-' . $elementvalue['key'] @@ -117,7 +127,7 @@ public function setElementsTca($tca) // check if this field is of type tab $formType = $fieldHelper->getFormType($fieldKey, $elementvalue['key'], 'tt_content'); - if ($formType == 'Tab') { + if ($formType === 'Tab') { $label = $fieldHelper->getLabel($elementvalue['key'], $fieldKey, 'tt_content'); // if a tab is in the first position then change the name of the general tab if ($index === 0) { @@ -148,9 +158,9 @@ public function setElementsTca($tca) * @param array $tca * @author Benjamin Butschell */ - public function setPageTca($tca) + public function setPageTca($tca): void { - $fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); + $fieldHelper = GeneralUtility::makeInstance(FieldHelper::class); $prependTabs = '--div--;Content-Fields,'; if ($tca) { $i = 0; @@ -161,7 +171,7 @@ public function setPageTca($tca) // check if this field is of type tab $formType = $fieldHelper->getFormType($fieldKey, $element['key'], 'pages'); - if ($formType == 'Tab') { + if ($formType === 'Tab') { $label = $fieldHelper->getLabel($element['key'], $fieldKey, 'pages'); // if a tab is in the first position then change the name of the general tab if ($i === 0) { @@ -182,19 +192,19 @@ public function setPageTca($tca) } else { $pageFieldString = $prependTabs; } - - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('pages', $pageFieldString); + ExtensionManagementUtility::addToAllTCAtypes('pages', $pageFieldString); } /** * Generates the TCA for fields * * @param array $tca - * @return string + * @return array + * @throws Exception */ - public function generateFieldsTca($tca) + public function generateFieldsTca($tca): array { - $generalUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Utility\\GeneralUtility'); + $generalUtility = GeneralUtility::makeInstance(\MASK\Mask\Utility\GeneralUtility::class); $columns = array(); if ($tca) { foreach ($tca as $tcakey => $tcavalue) { @@ -202,7 +212,7 @@ public function generateFieldsTca($tca) if ($tcavalue) { foreach ($tcavalue as $fieldkey => $fieldvalue) { // Add File-Config for file-field - if ($fieldkey == 'options' && $fieldvalue == 'file') { + if ($fieldkey === 'options' && $fieldvalue === 'file') { $fieldName = $tcakey; $customSettingOverride = array( 'overrideChildTca' => array( @@ -230,56 +240,56 @@ public function generateFieldsTca($tca) ); $customSettingOverride['appearance'] = $tcavalue['config']['appearance']; - if ($customSettingOverride['appearance']['fileUploadAllowed'] == '') { + if ($customSettingOverride['appearance']['fileUploadAllowed'] === '') { $customSettingOverride['appearance']['fileUploadAllowed'] = false; } - if ($customSettingOverride['appearance']['useSortable'] == '') { + if ($customSettingOverride['appearance']['useSortable'] === '') { $customSettingOverride['appearance']['useSortable'] = 0; } else { $customSettingOverride['appearance']['useSortable'] = 1; } - if ($tcavalue['config']['filter']['0']['parameters']['allowedFileExtensions'] != '') { + if ($tcavalue['config']['filter']['0']['parameters']['allowedFileExtensions'] !== '') { $allowedFileExtensions = $tcavalue['config']['filter']['0']['parameters']['allowedFileExtensions']; } else { $allowedFileExtensions = $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']; } - $columns[$tcakey]['config'] = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig($fieldName, + $columns[$tcakey]['config'] = ExtensionManagementUtility::getFileFieldTCAConfig($fieldName, $customSettingOverride, $allowedFileExtensions); } // check if field is actually a tab - if (isset($fieldvalue['type']) && $fieldvalue['type'] == 'tab') { + if (isset($fieldvalue['type']) && $fieldvalue['type'] === 'tab') { $addToTca = false; } // Fill missing tablename in TCA-Config for inline-fields - if ($fieldkey == 'config' && $tcavalue[$fieldkey]['foreign_table'] == '--inlinetable--') { + if ($fieldkey === 'config' && $tcavalue[$fieldkey]['foreign_table'] === '--inlinetable--') { $tcavalue[$fieldkey]['foreign_table'] = $tcakey; } // set date ranges if date or datetime field - if ($fieldkey == 'config' && ($tcavalue[$fieldkey]['dbType'] == 'date' || $tcavalue[$fieldkey]['dbType'] == 'datetime')) { - if ($tcavalue[$fieldkey]['range']['upper'] != '') { + if ($fieldkey === 'config' && ($tcavalue[$fieldkey]['dbType'] === 'date' || $tcavalue[$fieldkey]['dbType'] === 'datetime')) { + if ($tcavalue[$fieldkey]['range']['upper'] !== '') { $date = new \DateTime($tcavalue[$fieldkey]['range']['upper']); $tcavalue[$fieldkey]['range']['upper'] = $date->getTimestamp() + 86400; } - if ($tcavalue[$fieldkey]['range']['lower'] != '') { + if ($tcavalue[$fieldkey]['range']['lower'] !== '') { $date = new \DateTime($tcavalue[$fieldkey]['range']['lower']); $tcavalue[$fieldkey]['range']['lower'] = $date->getTimestamp() + 86400; } } // set correct rendertype if format (code highlighting) is set in text tca - if ($fieldkey == 'config' && $tcavalue[$fieldkey]['format'] != '') { + if ($fieldkey === 'config' && $tcavalue[$fieldkey]['format'] !== '') { $tcavalue[$fieldkey]['renderType'] = 't3editor'; } // make some adjustmens to content fields if ( - $fieldkey == 'config' && - $tcavalue[$fieldkey]['foreign_table'] == 'tt_content' && - $tcavalue[$fieldkey]['type'] == 'inline' + $fieldkey === 'config' && + $tcavalue[$fieldkey]['foreign_table'] === 'tt_content' && + $tcavalue[$fieldkey]['type'] === 'inline' ) { $tcavalue[$fieldkey]['foreign_field'] = $tcakey . '_parent'; if ($tcavalue['cTypes']) { @@ -291,8 +301,7 @@ public function generateFieldsTca($tca) if (!is_array($columns[$tcakey])) { $columns[$tcakey] = array(); } else { - \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($columns[$tcakey], - $tcavalue); + ArrayUtility::mergeRecursiveWithOverrule($columns[$tcakey], $tcavalue); } if (isset($columns[$tcakey]['rte'])) { @@ -300,17 +309,15 @@ public function generateFieldsTca($tca) } // Unset some values that are not needed in TCA - unset($columns[$tcakey]['options']); - unset($columns[$tcakey]['key']); - unset($columns[$tcakey]['rte']); - unset($columns[$tcakey]['inlineParent']); - unset($columns[$tcakey]['inlineLabel']); - unset($columns[$tcakey]['inlineIcon']); - unset($columns[$tcakey]['cTypes']); - - -// $GLOBALS['TCA']["tt_content"]["types"]["mask_asdfsdaf"]["columnsOverrides"]["tx_mask_".$tcakey]["config"]['enableRichtext'] = 1; -// $GLOBALS['TCA']["tt_content"]["types"]["mask_asdfsdaf"]["columnsOverrides"]["tx_mask_".$tcakey]["config"]['richtextConfiguration'] = 'default'; + unset( + $columns[$tcakey]['options'], + $columns[$tcakey]['key'], + $columns[$tcakey]['rte'], + $columns[$tcakey]['inlineParent'], + $columns[$tcakey]['inlineLabel'], + $columns[$tcakey]['inlineIcon'], + $columns[$tcakey]['cTypes'] + ); $columns[$tcakey] = $generalUtility->removeBlankOptions($columns[$tcakey]); $columns[$tcakey] = $generalUtility->replaceKey($columns[$tcakey], $tcakey); @@ -330,10 +337,10 @@ public function generateFieldsTca($tca) * * @param string $table * @param array $tca - * @return string + * @return void * @author Benjamin Butschell */ - public function generateTableTca($table, $tca) + public function generateTableTca($table, $tca): void { $tcaTemplate = array( @@ -477,14 +484,15 @@ public function generateTableTca($table, $tca) ), ); - $fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); - $generalUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Utility\\GeneralUtility'); + $fieldHelper = GeneralUtility::makeInstance(FieldHelper::class); + $generalUtility = GeneralUtility::makeInstance(\MASK\Mask\Utility\GeneralUtility::class); + $fields = []; // now add all the fields that should be shown $prependTabs = 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, '; if ($tca) { $i = 0; - uasort($tca, function ($columnA, $columnB) { + uasort($tca, static function ($columnA, $columnB) { $a = isset($columnA['order']) ? (int)$columnA['order'] : 0; $b = isset($columnB['order']) ? (int)$columnB['order'] : 0; return $a - $b; @@ -493,7 +501,7 @@ public function generateTableTca($table, $tca) foreach ($tca as $fieldKey => $configuration) { // check if this field is of type tab $formType = $fieldHelper->getFormType($fieldKey, '', $table); - if ($formType == 'Tab') { + if ($formType === 'Tab') { $label = $configuration['label']; // if a tab is in the first position then change the name of the general tab if ($i === 0) { @@ -510,6 +518,7 @@ public function generateTableTca($table, $tca) } // take first field for inline label + $labelField = ''; if (!empty($fields)) { $labelField = $generalUtility->getFirstNoneTabField($fields); } @@ -522,11 +531,11 @@ public function generateTableTca($table, $tca) $tableTca['ctrl']['title'] = $table; $tableTca['ctrl']['label'] = $labelField; - $tableTca['ctrl']['searchFields'] = implode(',', (array)$fields); - $tableTca['interface']['showRecordFieldList'] = 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, ' . implode(', ', - (array)$fields); - $tableTca['types']['1']['showitem'] = $prependTabs . implode(', ', - (array)$fields) . ', --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'; + $tableTca['ctrl']['searchFields'] = implode(',', $fields); + $tableTca['interface']['showRecordFieldList'] = 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, ' + . implode(', ', $fields); + $tableTca['types']['1']['showitem'] = $prependTabs . implode(', ', $fields) + . ', --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'; $tableTca['columns']['l10n_parent']['config']['foreign_table'] = $table; $tableTca['columns']['l10n_parent']['config']['foreign_table_where'] = 'AND ' . $table . '.pid=###CURRENT_PID### AND ' . $table . '.sys_language_uid IN (-1,0)'; @@ -542,14 +551,15 @@ public function generateTableTca($table, $tca) * allow all inline tables on standard pages * * @param array $configuration + * @noinspection PhpUnused */ - public function allowInlineTablesOnStandardPages($configuration) + public function allowInlineTablesOnStandardPages($configuration): void { $notIrreTables = array('pages', 'tt_content', 'sys_file_reference'); if ($configuration) { foreach ($configuration as $table => $subJson) { - if (array_search($table, $notIrreTables) === false) { - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages($table); + if (!in_array($table, $notIrreTables, true)) { + ExtensionManagementUtility::allowTableOnStandardPages($table); } } } diff --git a/Classes/CodeGenerator/TyposcriptCodeGenerator.php b/Classes/CodeGenerator/TyposcriptCodeGenerator.php index c60ffe8b..3082e08d 100644 --- a/Classes/CodeGenerator/TyposcriptCodeGenerator.php +++ b/Classes/CodeGenerator/TyposcriptCodeGenerator.php @@ -30,6 +30,8 @@ use MASK\Mask\Domain\Model\BackendLayout; use MASK\Mask\Utility\GeneralUtility as MaskUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Core\Imaging\IconRegistry; +use MASK\Mask\Imaging\IconProvider\ContentElementIconProvider; /** * Generates all the typoscript needed for mask content elements @@ -46,11 +48,11 @@ class TyposcriptCodeGenerator extends AbstractCodeGenerator * @param array $json * @return string */ - public function generateTsConfig($json) + public function generateTsConfig($json): string { // generate page TSconfig $content = ''; - $iconRegistry = GeneralUtility::makeInstance("TYPO3\CMS\Core\Imaging\IconRegistry"); + $iconRegistry = GeneralUtility::makeInstance(IconRegistry::class); // make content-Elements if ($json['tt_content']['elements']) { @@ -58,7 +60,7 @@ public function generateTsConfig($json) // Register icons for contentelements $iconIdentifier = 'mask-ce-' . $element['key']; $iconRegistry->registerIcon( - $iconIdentifier, "MASK\Mask\Imaging\IconProvider\ContentElementIconProvider", array( + $iconIdentifier, ContentElementIconProvider::class, array( 'contentElementKey' => $element['key'] ) ); @@ -102,7 +104,7 @@ public function generateTsConfig($json) * @param array $json * @return string */ - public function generatePageTyposcript($json) + public function generatePageTyposcript($json): string { $pageColumns = array(); $disableColumns = ''; @@ -138,8 +140,9 @@ public function generatePageTyposcript($json) * @param array $configuration * @param array $settings * @return string + * @noinspection PhpUnused */ - public function generateSetupTyposcript($configuration, $settings) + public function generateSetupTyposcript($configuration, $settings): string { // generate TypoScript setup $setupContent = []; @@ -212,7 +215,7 @@ public function generateSetupTyposcript($configuration, $settings) * @param boolean $init Internal * @return string TypoScript */ - protected function convertArrayToTypoScript(array $typoScriptArray, $addKey = '', $tab = 0, $init = true) + protected function convertArrayToTypoScript(array $typoScriptArray, $addKey = '', $tab = 0, $init = true): string { $typoScript = ''; if ($addKey !== '') { diff --git a/Classes/Controller/WizardContentController.php b/Classes/Controller/WizardContentController.php index 38876ed0..3e4f790d 100755 --- a/Classes/Controller/WizardContentController.php +++ b/Classes/Controller/WizardContentController.php @@ -27,9 +27,12 @@ * This copyright notice MUST APPEAR in all copies of the script! * ************************************************************* */ +use MASK\Mask\Domain\Repository\IconRepository; +use MASK\Mask\Domain\Repository\StorageRepository; use MASK\Mask\Utility\GeneralUtility as MaskUtility; use TYPO3\CMS\Extbase\Annotation\Inject; -use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Extbase\Mvc\Exception\StopActionException; +use TYPO3\CMS\Extbase\Utility\LocalizationUtility; /** * @@ -44,7 +47,7 @@ class WizardContentController extends WizardController /** * StorageRepository * - * @var \MASK\Mask\Domain\Repository\StorageRepository + * @var StorageRepository * @Inject() */ protected $storageRepository; @@ -52,7 +55,7 @@ class WizardContentController extends WizardController /** * IconRepository * - * @var \MASK\Mask\Domain\Repository\IconRepository + * @var IconRepository * @Inject() */ protected $iconRepository; @@ -62,7 +65,7 @@ class WizardContentController extends WizardController * * @return void */ - public function listAction() + public function listAction(): void { $this->checkFolders(); $this->view->assign('missingFolders', $this->missingFolders); @@ -74,7 +77,7 @@ public function listAction() * * @return void */ - public function newAction() + public function newAction(): void { $icons = $this->iconRepository->findAll(); $this->view->assign('icons', $icons); @@ -86,14 +89,13 @@ public function newAction() * @param array $storage * @return void */ - public function createAction($storage) + public function createAction($storage): void { $this->storageRepository->add($storage); $this->generateAction(); $html = $this->htmlCodeGenerator->generateHtml($storage['elements']['key'], 'tt_content'); $this->saveHtml($storage['elements']['key'], $html); - $this->addFlashMessage(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_mask.content.newcontentelement', - 'mask')); + $this->addFlashMessage(LocalizationUtility::translate('tx_mask.content.newcontentelement', 'mask')); $this->redirectByAction(); } @@ -104,7 +106,7 @@ public function createAction($storage) * @param string $key * @return void */ - public function editAction($type, $key) + public function editAction($type, $key): void { $storage = $this->storageRepository->loadElement($type, $key); $icons = $this->iconRepository->findAll(); @@ -120,14 +122,13 @@ public function editAction($type, $key) * @param array $storage * @return void */ - public function updateAction($storage) + public function updateAction($storage): void { $this->storageRepository->update($storage); $this->generateAction(); $html = $this->htmlCodeGenerator->generateHtml($storage['elements']['key'], 'tt_content'); $this->saveHtml($storage['elements']['key'], $html); - $this->addFlashMessage(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_mask.content.updatedcontentelement', - 'mask')); + $this->addFlashMessage(LocalizationUtility::translate('tx_mask.content.updatedcontentelement', 'mask')); $this->redirectByAction(); } @@ -137,13 +138,13 @@ public function updateAction($storage) * @param string $key * @param string $type * @return void + * @throws StopActionException */ - public function deleteAction($key, $type) + public function deleteAction($key, $type): void { $this->storageRepository->remove($type, $key); $this->generateAction(); - $this->addFlashMessage(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_mask.content.deletedcontentelement', - 'mask')); + $this->addFlashMessage(LocalizationUtility::translate('tx_mask.content.deletedcontentelement', 'mask')); $this->redirect('list'); } @@ -153,14 +154,14 @@ public function deleteAction($key, $type) * @param string $key * @param string $type * @return void + * @throws StopActionException */ - public function purgeAction($key, $type) + public function purgeAction($key, $type): void { $this->deleteHtml($key); $this->storageRepository->remove($type, $key); $this->generateAction(); - $this->addFlashMessage(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_mask.content.deletedcontentelement', - 'mask')); + $this->addFlashMessage(LocalizationUtility::translate('tx_mask.content.deletedcontentelement', 'mask')); $this->redirect('list'); } @@ -169,13 +170,13 @@ public function purgeAction($key, $type) * * @param string $key * @return void + * @throws StopActionException */ - public function hideAction($key) + public function hideAction($key): void { $this->storageRepository->hide('tt_content', $key); $this->generateAction(); - $this->addFlashMessage(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_mask.content.hiddencontentelement', - 'mask')); + $this->addFlashMessage(LocalizationUtility::translate('tx_mask.content.hiddencontentelement', 'mask')); $this->redirect('list'); } @@ -184,13 +185,13 @@ public function hideAction($key) * * @param string $key * @return void + * @throws StopActionException */ - public function activateAction($key) + public function activateAction($key): void { $this->storageRepository->activate('tt_content', $key); $this->generateAction(); - $this->addFlashMessage(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_mask.content.activatedcontentelement', - 'mask')); + $this->addFlashMessage(LocalizationUtility::translate('tx_mask.content.activatedcontentelement', 'mask')); $this->redirect('list'); } @@ -216,9 +217,10 @@ protected function deleteHtml($key): void * Create single Fluid html * * @param string $key + * @throws StopActionException * @author Gernot Ploiner */ - protected function createHtmlAction($key) + protected function createHtmlAction($key): void { $html = $this->htmlCodeGenerator->generateHtml($key, 'tt_content'); $this->saveHtml($key, $html); diff --git a/Classes/Controller/WizardController.php b/Classes/Controller/WizardController.php index 2b302759..d0934aab 100755 --- a/Classes/Controller/WizardController.php +++ b/Classes/Controller/WizardController.php @@ -1,4 +1,7 @@ -extSettings = $this->settingsService->get(); } @@ -138,8 +147,9 @@ public function initializeAction() * @author Gernot Ploiner * @author Benjamin Butschell * @todo clear typoscript cache after generating + * @noinspection PhpUnhandledExceptionInspection */ - public function generateAction() + public function generateAction(): void { // Update Database $this->sqlCodeGenerator->updateDatabase(); @@ -155,20 +165,18 @@ public function generateAction() * @param array $storage * @author Benjamin Butschell */ - protected function prepareStorage(&$storage) + protected function prepareStorage(&$storage): void { // Fill storage with additional data before assigning to view if ($storage['tca']) { foreach ($storage['tca'] as $key => $field) { - if (is_array($field)) { - if ($field['config']['type'] == 'inline') { - $storage['tca'][$key]['inlineFields'] = $this->storageRepository->loadInlineFields($key); - uasort($storage['tca'][$key]['inlineFields'], function ($columnA, $columnB) { - $a = isset($columnA['order']) ? (int)$columnA['order'] : 0; - $b = isset($columnB['order']) ? (int)$columnB['order'] : 0; - return $a - $b; - }); - } + if (is_array($field) && $field['config']['type'] === 'inline') { + $storage['tca'][$key]['inlineFields'] = $this->storageRepository->loadInlineFields($key); + uasort($storage['tca'][$key]['inlineFields'], static function ($columnA, $columnB) { + $a = isset($columnA['order']) ? (int)$columnA['order'] : 0; + $b = isset($columnB['order']) ? (int)$columnB['order'] : 0; + return $a - $b; + }); } } } @@ -181,7 +189,7 @@ protected function prepareStorage(&$storage) * @param string $table * @author Gernot Ploiner */ - protected function showHtmlAction($key, $table) + protected function showHtmlAction($key, $table): void { $html = $this->htmlCodeGenerator->generateHtml($key, $table); $this->view->assign('html', $html); @@ -192,9 +200,10 @@ protected function showHtmlAction($key, $table) * * @param string $key * @param string $html + * @return bool * @author Gernot Ploiner */ - protected function saveHtml($key, $html) + protected function saveHtml($key, $html): bool { # fallback to prevent breaking change $path = MaskUtility::getTemplatePath($this->extSettings, $key); @@ -207,15 +216,17 @@ protected function saveHtml($key, $html) /** * Checks if a key for a field is available + * @param ServerRequest $request + * @param Response $response + * @return Response + * @throws Exception + * @noinspection PhpUnused */ public function checkFieldKey(ServerRequest $request, Response $response): Response { $queryParams = $request->getQueryParams(); $fieldKey = $queryParams['key']; - $table = 'tt_content'; - if (isset($queryParams['table'])) { - $table = $queryParams['table']; - } + $table = $queryParams['table'] ?? 'tt_content'; $objectManager = GeneralUtility::makeInstance(ObjectManager::class); $storageRepository = $objectManager->get(StorageRepository::class); @@ -231,6 +242,11 @@ public function checkFieldKey(ServerRequest $request, Response $response): Respo /** * Checks if a key for an element is available + * @param ServerRequest $request + * @param Response $response + * @return Response + * @throws Exception + * @noinspection PhpUnused */ public function checkElementKey(ServerRequest $request, Response $response): Response { @@ -249,16 +265,19 @@ public function checkElementKey(ServerRequest $request, Response $response): Res /** * Redirects the request to the correct view + * @throws StopActionException * @author Benjamin Butschell */ - protected function redirectByAction() + protected function redirectByAction(): void { $params = $this->request->getArguments(); $formAction = $params['formAction']; $arguments = array(); - if ($params['storage']['type'] == 'pages') { - $arguments['layoutIdentifier'] = $this->backendLayoutRepository->findByIdentifier($params['storage']['elements']['key'], - explode(',', $this->extSettings['backendlayout_pids']))->getIdentifier(); + if ($params['storage']['type'] === 'pages') { + $arguments['layoutIdentifier'] = $this->backendLayoutRepository->findByIdentifier( + $params['storage']['elements']['key'], + explode(',', $this->extSettings['backendlayout_pids']) + )->getIdentifier(); } else { $arguments['key'] = $params['storage']['elements']['key']; $arguments['type'] = $params['storage']['type']; @@ -303,13 +322,14 @@ protected function createMissingFolders(): bool /** * action creates missing folders + * @throws StopActionException * @author Benjamin Butschell + * @noinspection PhpUnused */ public function createMissingFoldersAction(): void { if ($this->createMissingFolders()) { - $this->addFlashMessage(LocalizationUtility::translate('tx_mask.all.createdmissingfolders', - 'mask')); + $this->addFlashMessage(LocalizationUtility::translate('tx_mask.all.createdmissingfolders', 'mask')); } $this->redirect('list'); } diff --git a/Classes/Controller/WizardPageController.php b/Classes/Controller/WizardPageController.php index c6d9a701..0d6abf57 100755 --- a/Classes/Controller/WizardPageController.php +++ b/Classes/Controller/WizardPageController.php @@ -1,4 +1,7 @@ -settingsService->get(); $backendLayouts = $this->backendLayoutRepository->findAll(explode(',', $settings['backendlayout_pids'])); @@ -60,8 +67,9 @@ public function listAction() * action new * * @return void + * @noinspection PhpUnused */ - public function newAction() + public function newAction(): void { $settings = $this->settingsService->get(); $backendLayouts = $this->backendLayoutRepository->findAll(explode(',', $settings['backendlayout_pids'])); @@ -73,8 +81,10 @@ public function newAction() * * @param array $storage * @return void + * @throws StopActionException + * @noinspection PhpUnused */ - public function createAction($storage) + public function createAction($storage): void { $this->storageRepository->add($storage); $this->generateAction(); @@ -87,8 +97,9 @@ public function createAction($storage) * * @param string $layoutIdentifier * @return void + * @noinspection PhpUnused */ - public function editAction($layoutIdentifier = null) + public function editAction($layoutIdentifier = null): void { $settings = $this->settingsService->get(); $layout = $this->backendLayoutRepository->findByIdentifier($layoutIdentifier, @@ -108,13 +119,14 @@ public function editAction($layoutIdentifier = null) * * @param array $storage * @return void + * @throws StopActionException + * @noinspection PhpUnused */ - public function updateAction($storage) + public function updateAtion($storage): void { $this->storageRepository->update($storage); $this->generateAction(); - $this->addFlashMessage(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_mask.page.updatedpage', - 'mask')); + $this->addFlashMessage(LocalizationUtility::translate('tx_mask.page.updatedpage', 'mask')); $this->redirectByAction(); } @@ -123,11 +135,10 @@ public function updateAction($storage) * * @param array $storage * @return void + * @throws StopActionException */ - public function deleteAction(array $storage) + public function deleteAction(array $storage): void { - $this->storageRepository->remove($storage); - $this->addFlashMessage('Your Page was removed.'); $this->redirect('list'); } } diff --git a/Classes/DataProcessing/MaskProcessor.php b/Classes/DataProcessing/MaskProcessor.php index 3fdd4374..b4b78ac9 100644 --- a/Classes/DataProcessing/MaskProcessor.php +++ b/Classes/DataProcessing/MaskProcessor.php @@ -5,6 +5,8 @@ use MASK\Mask\Helper\InlineHelper; use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Extbase\Annotation\Inject; +use TYPO3\CMS\Extbase\Object\Exception; use TYPO3\CMS\Extbase\Object\ObjectManager; use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; use TYPO3\CMS\Frontend\ContentObject\DataProcessorInterface; @@ -15,7 +17,7 @@ class MaskProcessor implements DataProcessorInterface /** * InlineHelper * - * @var \MASK\Mask\Helper\InlineHelper + * @var InlineHelper * @Inject() */ protected $inlineHelper; @@ -28,13 +30,14 @@ class MaskProcessor implements DataProcessorInterface * @param array $processorConfiguration The configuration of this processor * @param array $processedData Key/value store of processed data (e.g. to be passed to a Fluid View) * @return array the processed data as key/value store + * @throws Exception */ public function process( ContentObjectRenderer $cObj, array $contentObjectConfiguration, array $processorConfiguration, array $processedData - ) { + ): array { $objectManager = GeneralUtility::makeInstance(ObjectManager::class); $this->inlineHelper = $objectManager->get(InlineHelper::class); diff --git a/Classes/Domain/Model/BackendLayout.php b/Classes/Domain/Model/BackendLayout.php index d4378963..4bbdc00d 100644 --- a/Classes/Domain/Model/BackendLayout.php +++ b/Classes/Domain/Model/BackendLayout.php @@ -31,13 +31,14 @@ * ************************************************************* */ use TYPO3\CMS\Extbase\Annotation\Validate; +use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; /** * This model represents a back-end user. * * @api */ -class BackendLayout extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity +class BackendLayout extends AbstractEntity { /** @@ -67,7 +68,7 @@ class BackendLayout extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity * * @return string the title, will not be empty */ - public function getTitle() + public function getTitle(): string { return $this->title; } @@ -78,7 +79,7 @@ public function getTitle() * @param string $title the user name to set, must not be empty * @return void */ - public function setTitle($title) + public function setTitle($title): void { $this->title = $title; } @@ -88,7 +89,7 @@ public function setTitle($title) * * @return int the uid, will not be empty */ - public function getUid() + public function getUid(): int { return $this->uid; } @@ -98,8 +99,9 @@ public function getUid() * * @param int $uid the user name to set, must not be empty * @return void + * @noinspection PhpUnused */ - public function setUid($uid) + public function setUid($uid): void { $this->uid = $uid; } @@ -109,7 +111,7 @@ public function setUid($uid) * * @return string the icon */ - public function getIcon() + public function getIcon(): string { return $this->icon; } @@ -120,7 +122,7 @@ public function getIcon() * @param string $icon * @return void */ - public function setIcon($icon) + public function setIcon($icon): void { $this->icon = $icon; } @@ -130,7 +132,7 @@ public function setIcon($icon) * * @return string description */ - public function getDescription() + public function getDescription(): string { return $this->description; } @@ -141,10 +143,8 @@ public function getDescription() * @param string $description * @return void */ - public function setDescription($description) + public function setDescription($description): void { $this->description = $description; } } - -?> diff --git a/Classes/Domain/Model/Content.php b/Classes/Domain/Model/Content.php index e2591c72..b433f3fc 100644 --- a/Classes/Domain/Model/Content.php +++ b/Classes/Domain/Model/Content.php @@ -28,6 +28,7 @@ * ************************************************************* */ use TYPO3\CMS\Extbase\Annotation\Validate; +use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; /** * @@ -36,7 +37,7 @@ * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 2 or later * */ -class Content extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity +class Content extends AbstractEntity { /** @@ -77,12 +78,19 @@ class Content extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity */ protected $contentType; - public function getContentType() + /** + * @return string + */ + public function getContentType(): string { return $this->contentType; } - public function setContentType($contentType) + /** + * @param $contentType + * @return Content + */ + public function setContentType($contentType): Content { $this->contentType = $contentType; return $this; @@ -93,7 +101,7 @@ public function setContentType($contentType) * * @return string $title */ - public function getTitle() + public function getTitle(): string { return $this->title; } @@ -104,7 +112,7 @@ public function getTitle() * @param string $title * @return void */ - public function setTitle($title) + public function setTitle($title): void { $this->title = $title; } @@ -114,7 +122,7 @@ public function setTitle($title) * * @return string $description */ - public function getDescription() + public function getDescription(): string { return $this->description; } @@ -125,7 +133,7 @@ public function getDescription() * @param string $description * @return void */ - public function setDescription($description) + public function setDescription($description): void { $this->description = $description; } @@ -135,7 +143,7 @@ public function setDescription($description) * * @return string $shorttitle */ - public function getShorttitle() + public function getShorttitle(): string { return $this->shorttitle; } @@ -146,7 +154,7 @@ public function getShorttitle() * @param string $shorttitle * @return void */ - public function setShorttitle($shorttitle) + public function setShorttitle($shorttitle): void { $this->shorttitle = $shorttitle; } @@ -156,7 +164,7 @@ public function setShorttitle($shorttitle) * * @return string $fieldkey */ - public function getFieldkey() + public function getFieldkey(): string { return $this->fieldkey; } @@ -167,7 +175,7 @@ public function getFieldkey() * @param string $fieldkey * @return void */ - public function setFieldkey($fieldkey) + public function setFieldkey($fieldkey): void { $this->fieldkey = $fieldkey; } diff --git a/Classes/Domain/Model/Page.php b/Classes/Domain/Model/Page.php index 5f65ce55..53ee4d5a 100644 --- a/Classes/Domain/Model/Page.php +++ b/Classes/Domain/Model/Page.php @@ -28,6 +28,7 @@ * ************************************************************* */ use TYPO3\CMS\Extbase\Annotation\Validate; +use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; /** * @@ -36,7 +37,7 @@ * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 2 or later * */ -class Page extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity +class Page extends AbstractEntity { /** @@ -81,7 +82,7 @@ class Page extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity * * @return string $title */ - public function getTitle() + public function getTitle(): string { return $this->title; } @@ -92,7 +93,7 @@ public function getTitle() * @param string $title * @return void */ - public function setTitle($title) + public function setTitle($title): void { $this->title = $title; } @@ -102,7 +103,7 @@ public function setTitle($title) * * @return integer $belayout */ - public function getBelayout() + public function getBelayout(): int { return $this->belayout; } @@ -113,7 +114,7 @@ public function getBelayout() * @param integer $belayout * @return void */ - public function setBelayout($belayout) + public function setBelayout($belayout): void { $this->belayout = $belayout; } @@ -123,7 +124,7 @@ public function setBelayout($belayout) * * @return string $fieldkey */ - public function getFieldkey() + public function getFieldkey(): string { return $this->fieldkey; } @@ -134,7 +135,7 @@ public function getFieldkey() * @param string $fieldkey * @return void */ - public function setFieldkey($fieldkey) + public function setFieldkey($fieldkey): void { $this->fieldkey = $fieldkey; } @@ -144,7 +145,7 @@ public function setFieldkey($fieldkey) * * @return string $header */ - public function getHeader() + public function getHeader(): string { return $this->header; } @@ -155,7 +156,7 @@ public function getHeader() * @param string $header * @return void */ - public function setHeader($header) + public function setHeader($header): void { $this->header = $header; } @@ -165,7 +166,7 @@ public function setHeader($header) * * @return boolean $defaulttemplate */ - public function getDefaulttemplate() + public function getDefaulttemplate(): bool { return $this->defaulttemplate; } @@ -176,7 +177,7 @@ public function getDefaulttemplate() * @param boolean $defaulttemplate * @return void */ - public function setDefaulttemplate($defaulttemplate) + public function setDefaulttemplate($defaulttemplate): void { $this->defaulttemplate = $defaulttemplate; } @@ -186,10 +187,8 @@ public function setDefaulttemplate($defaulttemplate) * * @return boolean */ - public function isDefaulttemplate() + public function isDefaulttemplate(): bool { return $this->getDefaulttemplate(); } } - -?> diff --git a/Classes/Domain/Repository/BackendLayoutRepository.php b/Classes/Domain/Repository/BackendLayoutRepository.php index d491995b..7c3a8c0c 100644 --- a/Classes/Domain/Repository/BackendLayoutRepository.php +++ b/Classes/Domain/Repository/BackendLayoutRepository.php @@ -28,9 +28,16 @@ * ************************************************************* */ use Doctrine\DBAL\FetchMode; +use Exception; +use MASK\Mask\Backend\BackendLayoutView; +use RuntimeException; +use TYPO3\CMS\Backend\Utility\BackendUtility; +use TYPO3\CMS\Backend\View\BackendLayout\BackendLayout; use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings; +use TYPO3\CMS\Extbase\Persistence\Repository; use TYPO3\CMS\Frontend\Page\PageRepository; /** @@ -38,11 +45,11 @@ * * @api */ -class BackendLayoutRepository extends \TYPO3\CMS\Extbase\Persistence\Repository +class BackendLayoutRepository extends Repository { /** - * @var MASK\Mask\Backend\BackendLayoutView + * @var BackendLayoutView */ protected $backendLayoutView; @@ -51,13 +58,12 @@ class BackendLayoutRepository extends \TYPO3\CMS\Extbase\Persistence\Repository * * @return void */ - public function initializeObject() + public function initializeObject(): void { - /** @var $querySettings \TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings */ - $querySettings = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Typo3QuerySettings'); + $querySettings = $this->objectManager->get(Typo3QuerySettings::class); $querySettings->setRespectStoragePage(false); $this->setDefaultQuerySettings($querySettings); - $this->backendLayoutView = GeneralUtility::makeInstance(\MASK\Mask\Backend\BackendLayoutView::class); + $this->backendLayoutView = GeneralUtility::makeInstance(BackendLayoutView::class); } /** @@ -65,13 +71,13 @@ public function initializeObject() * @param array $pageTsPids * @return array */ - public function findAll($pageTsPids = array()) + public function findAll($pageTsPids = array()): array { $backendLayouts = array(); // search all the pids for backend layouts defined in the pageTS foreach ($pageTsPids as $pid) { - $pageTsConfig = (array)\TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($pid); + $pageTsConfig = (array)BackendUtility::getPagesTSconfig($pid); $dataProviderContext = $this->backendLayoutView->createDataProviderContext()->setPageTsConfig($pageTsConfig); $backendLayoutCollections = $this->backendLayoutView->getDataProviderCollection()->getBackendLayoutCollections($dataProviderContext); foreach ($backendLayoutCollections['default']->getAll() as $backendLayout) { @@ -85,7 +91,7 @@ public function findAll($pageTsPids = array()) // also search in the database for backendlayouts $databaseBackendLayouts = parent::findAll(); foreach ($databaseBackendLayouts as $layout) { - $backendLayout = new \TYPO3\CMS\Backend\View\BackendLayout\BackendLayout($layout->getUid(), + $backendLayout = new BackendLayout($layout->getUid(), $layout->getTitle(), ''); if ($layout->getIcon()) { $backendLayout->setIconPath('/uploads/media/' . $layout->getIcon()); @@ -100,9 +106,9 @@ public function findAll($pageTsPids = array()) /** * @param $pid * @return bool - * @throws \Exception + * @throws Exception */ - public function findIdentifierByPid($pid) + public function findIdentifierByPid($pid): bool { /** @var Connection $connection */ $connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable('pages'); @@ -122,19 +128,23 @@ public function findIdentifierByPid($pid) $backend_layout_next_level = $data['backend_layout_next_level']; if ($backend_layout !== '') { // If backend_layout is set on current page return $backend_layout; - } elseif ($backend_layout_next_level !== '') { // If backend_layout_next_level is set on current page + } + + if ($backend_layout_next_level !== '') { // If backend_layout_next_level is set on current page return $backend_layout_next_level; - } else { // If backend_layout and backend_layout_next_level is not set on current page, check backend_layout_next_level on rootline - $sysPage = GeneralUtility::makeInstance(PageRepository::class); - try { - $rootline = $sysPage->getRootLine($pid, ''); - } catch (\RuntimeException $ex) { - $rootline = []; - } - foreach ($rootline as $page) { - if ($page['backend_layout_next_level'] !== '') { - return $page['backend_layout_next_level']; - } + } + + // If backend_layout and backend_layout_next_level is not set on current page, check backend_layout_next_level on rootline + $sysPage = GeneralUtility::makeInstance(PageRepository::class); + + try { + $rootline = $sysPage->getRootLine($pid, ''); + } catch (RuntimeException $ex) { + $rootline = []; + } + foreach ($rootline as $page) { + if ($page['backend_layout_next_level'] !== '') { + return $page['backend_layout_next_level']; } } return null; @@ -146,16 +156,12 @@ public function findIdentifierByPid($pid) * * @param $identifier * @param array $pageTsPids - * @return \TYPO3\CMS\Backend\View\BackendLayout\BackendLayout + * @return BackendLayout|null */ - public function findByIdentifier($identifier, $pageTsPids = array()) + public function findByIdentifier($identifier, $pageTsPids = array()): ?BackendLayout { $backendLayouts = $this->findAll($pageTsPids); - if (isset($backendLayouts[$identifier])) { - return $backendLayouts[$identifier]; - } else { - return null; - } + return $backendLayouts[$identifier] ?? null; } } diff --git a/Classes/Domain/Repository/ContentRepository.php b/Classes/Domain/Repository/ContentRepository.php index e4d03a01..93f28ba5 100644 --- a/Classes/Domain/Repository/ContentRepository.php +++ b/Classes/Domain/Repository/ContentRepository.php @@ -27,20 +27,23 @@ * This copyright notice MUST APPEAR in all copies of the script! * ************************************************************* */ +use TYPO3\CMS\Extbase\Persistence\Repository; +use TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings; + /** * * * @package mask * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 2 or later * + * @method findByContentType(string $string) */ -class ContentRepository extends \TYPO3\CMS\Extbase\Persistence\Repository +class ContentRepository extends Repository { - public function initializeObject() + public function initializeObject(): void { - /** @var $querySettings TYPO3CMSExtbasePersistenceGenericTypo3QuerySettings */ - $querySettings = $this->objectManager->get('TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings'); + $querySettings = $this->objectManager->get(Typo3QuerySettings::class); $querySettings->setRespectStoragePage(false); $querySettings->setIgnoreEnableFields(false); $querySettings->setIncludeDeleted(false); diff --git a/Classes/Domain/Repository/IconRepository.php b/Classes/Domain/Repository/IconRepository.php index e22dcab4..23846f3e 100644 --- a/Classes/Domain/Repository/IconRepository.php +++ b/Classes/Domain/Repository/IconRepository.php @@ -40,7 +40,7 @@ class IconRepository * Returns an array of all the available * @return array */ - public function findAll() + public function findAll(): array { $icons = array( 'fa-500px', @@ -830,6 +830,7 @@ public function findAll() 'fa-youtube-play', 'fa-youtube-square' ); + $preparedIcons = []; foreach ($icons as $icon) { $preparedIcons[$icon] = $icon; } diff --git a/Classes/Domain/Repository/PageRepository.php b/Classes/Domain/Repository/PageRepository.php index d2df749d..5b29bc6e 100644 --- a/Classes/Domain/Repository/PageRepository.php +++ b/Classes/Domain/Repository/PageRepository.php @@ -27,6 +27,8 @@ * This copyright notice MUST APPEAR in all copies of the script! * ************************************************************* */ +use TYPO3\CMS\Extbase\Persistence\Repository; + /** * * @@ -34,7 +36,7 @@ * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 2 or later * */ -class PageRepository extends \TYPO3\CMS\Extbase\Persistence\Repository +class PageRepository extends Repository { } diff --git a/Classes/Domain/Repository/StorageRepository.php b/Classes/Domain/Repository/StorageRepository.php index fbf3c33c..aa40f2ad 100644 --- a/Classes/Domain/Repository/StorageRepository.php +++ b/Classes/Domain/Repository/StorageRepository.php @@ -30,8 +30,10 @@ * This copyright notice MUST APPEAR in all copies of the script! * ************************************************************* */ +use MASK\Mask\CodeGenerator\SqlCodeGenerator; +use MASK\Mask\Domain\Service\SettingsService; +use MASK\Mask\Helper\FieldHelper; use MASK\Mask\Utility\GeneralUtility as MaskUtility; -use TYPO3\CMS\Core\Core\Environment; use TYPO3\CMS\Core\Utility\GeneralUtility; /** @@ -45,21 +47,14 @@ class StorageRepository /** * FieldHelper * - * @var \MASK\Mask\Helper\FieldHelper + * @var FieldHelper */ protected $fieldHelper; - /** - * SqlCodeGenerator - * - * @var \MASK\Mask\CodeGenerator\SqlCodeGenerator - */ - protected $sqlCodeGenerator; - /** * SettingsService * - * @var \MASK\Mask\Domain\Service\SettingsService + * @var SettingsService */ protected $settingsService; @@ -74,14 +69,14 @@ class StorageRepository * json configuration * @var array */ - private static $json = null; + private static $json; /** * is called before every action */ public function __construct() { - $this->settingsService = GeneralUtility::makeInstance('MASK\\Mask\\Domain\\Service\\SettingsService'); + $this->settingsService = GeneralUtility::makeInstance(SettingsService::class); $this->extSettings = $this->settingsService->get(); } @@ -89,15 +84,16 @@ public function __construct() * Load Storage * * @return array + * @noinspection PhpComposerExtensionStubsInspection */ - public function load() + public function load(): array { if (self::$json === null) { self::$json = array(); if (!empty($this->extSettings['json'])) { $file = MaskUtility::getFileAbsFileName($this->extSettings['json']); if (file_exists($file)) { - self::$json = json_decode(file_get_contents($file), true); + self::$json = json_decode(file_get_contents($file), true, 512, JSON_THROW_ON_ERROR); } } } @@ -109,14 +105,15 @@ public function load() * * @param $json * @return void + * @noinspection PhpComposerExtensionStubsInspection */ - public function write($json) + public function write($json): void { if (!empty($this->extSettings['json'])) { $file = MaskUtility::getFileAbsFileName($this->extSettings['json']); GeneralUtility::writeFile( $file, - json_encode($json, JSON_PRETTY_PRINT) + json_encode($json, JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT, 512) ); } self::$json = $json; @@ -124,10 +121,12 @@ public function write($json) /** * Load Field + * @param $type + * @param $key * @return array * @author Benjamin Butschell */ - public function loadField($type, $key) + public function loadField($type, $key): array { $json = $this->load(); return $json[$type]['tca'][$key]; @@ -140,15 +139,15 @@ public function loadField($type, $key) * @return array * @author Benjamin Butschell */ - public function loadInlineFields($parentKey) + public function loadInlineFields($parentKey): array { $json = $this->load(); $inlineFields = array(); foreach ($json as $table) { if ($table['tca']) { foreach ($table['tca'] as $key => $tca) { - if ($tca['inlineParent'] == $parentKey) { - if ($tca['config']['type'] == 'inline') { + if ($tca['inlineParent'] === $parentKey) { + if ($tca['config']['type'] === 'inline') { $tca['inlineFields'] = $this->loadInlineFields($key); } $tca['maskKey'] = 'tx_mask_' . $tca['key']; @@ -163,9 +162,11 @@ public function loadInlineFields($parentKey) /** * Load Element with all the field configurations * + * @param $type + * @param $key * @return array */ - public function loadElement($type, $key) + public function loadElement($type, $key): array { $json = $this->load(); $fields = array(); @@ -187,8 +188,9 @@ public function loadElement($type, $key) * Adds new Content-Element * * @param array $content + * @noinspection NotOptimalIfConditionsInspection */ - public function add($content) + public function add($content): void { // Load $json = $this->load(); @@ -196,16 +198,12 @@ public function add($content) // Create JSON elements Array: foreach ($content['elements'] as $key => $value) { // delete columns and labels of irre-fields from elements - if ($key == 'columns' || $key == 'labels') { + if ($key === 'columns' || $key === 'labels') { foreach ($value as $index => $column) { - if (!$content['tca'][$index]['inlineParent']) { - $contentColumns[] = $column; - } else { - unset($value[$index]); + if ($content['tca'][$index]['inlineParent']) { unset($value[$index]); } - if ($key === 'labels' - && empty($column) + if (($key === 'labels') && empty($column) && isset($json[$content['type']]['tca'][$content['elements']['columns'][$index]]) ) { // If using a mask field with empty label, we have to set the "default" label @@ -213,7 +211,8 @@ public function add($content) foreach ($json[$content['type']]['elements'] as $element) { if (is_array($element['columns']) && in_array($content['elements']['columns'][$index], $element['columns'], true)) { - $i = array_search($content['elements']['columns'][$index], $element['columns'], true); + $i = array_search($content['elements']['columns'][$index], $element['columns'], + true); if (!empty($element['labels'][$i])) { $label = $element['labels'][$i]; break; @@ -227,17 +226,16 @@ public function add($content) $json[$content['type']]['elements'][$content['elements']['key']][$key] = $value; } - $contentColumns = array(); $columns = array(); // delete columns and labels of irre-fields from elements if ($content['elements']['columns']) { foreach ($content['elements']['columns'] as $index => $column) { - if (!$content['tca'][$index]['inlineParent']) { - $contentColumns[] = $column; - } else { - unset($content['elements']['columns'][$index]); - unset($content['elements']['labels'][$index]); + if ($content['tca'][$index]['inlineParent']) { + unset( + $content['elements']['columns'][$index], + $content['elements']['labels'][$index] + ); } $columns[] = $column; } @@ -256,7 +254,6 @@ public function add($content) // Create JSON tca Array: if (is_array($content['tca'])) { - foreach ($content['tca'] as $key => $value) { $inlineField = false; @@ -272,7 +269,7 @@ public function add($content) // add rte flag if inline and rte if ($inlineField) { - if ($content['elements']['options'][$key] == 'rte') { + if ($content['elements']['options'][$key] === 'rte') { $json[$type]['tca'][$columns[$key]]['rte'] = '1'; } } @@ -304,7 +301,7 @@ public function add($content) * @param string $key * @param array $remainingFields */ - public function remove($type, $key, $remainingFields = array()) + public function remove($type, $key, $remainingFields = array()): void { // Load $json = $this->load(); @@ -327,7 +324,7 @@ public function remove($type, $key, $remainingFields = array()) * @param string $type * @param string $key */ - public function hide($type, $key) + public function hide($type, $key): void { // Load $json = $this->load(); @@ -342,7 +339,7 @@ public function hide($type, $key) * @param string $type * @param string $key */ - public function activate($type, $key) + public function activate($type, $key): void { // Load $json = $this->load(); @@ -361,10 +358,9 @@ public function activate($type, $key) * @author Benjamin Butschell * */ - private function removeField($table, $field, $json, $remainingFields = array()) + private function removeField($table, $field, $json, $remainingFields = array()): array { - - $this->fieldHelper = GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); + $this->fieldHelper = GeneralUtility::makeInstance(FieldHelper::class); // check if this field is used in any other elements $elementsInUse = array(); @@ -372,7 +368,7 @@ private function removeField($table, $field, $json, $remainingFields = array()) foreach ($json[$table]['elements'] as $element) { if ($element['columns']) { foreach ($element['columns'] as $column) { - if ($column == $field) { + if ($column === $field) { $elementsInUse[] = $element; } } @@ -385,7 +381,7 @@ private function removeField($table, $field, $json, $remainingFields = array()) $fatherFound = false; if ($remainingFields) { foreach ($remainingFields as $remainingField) { - if ($field == 'tx_mask_' . $remainingField) { + if ($field === 'tx_mask_' . $remainingField) { $fatherFound = true; } } @@ -393,7 +389,7 @@ private function removeField($table, $field, $json, $remainingFields = array()) $fatherGetsDeleted = !$fatherFound; // if the field is a repeating field, make some exceptions - if ($json[$table]['tca'][$field]['config']['type'] == 'inline') { + if ($json[$table]['tca'][$field]['config']['type'] === 'inline') { $inlineFields = $this->loadInlineFields($field); if ($inlineFields) { // Recursively delete all inline-fields if necessary @@ -402,20 +398,31 @@ private function removeField($table, $field, $json, $remainingFields = array()) // check if the fields are really deleted, or if they are just deleted temporarly for update action if ($remainingFields) { foreach ($remainingFields as $remainingField) { - if ($inlineField['key'] == $remainingField) { + if ($inlineField['key'] === $remainingField) { $found = true; } } } if ($found) { // was not really deleted => can be deleted temporarly because it will be readded - $json = $this->removeField($inlineField['inlineParent'], 'tx_mask_' . $inlineField['key'], - $json); + $json = $this->removeField( + $inlineField['inlineParent'], + 'tx_mask_' . $inlineField['key'], + $json + ); } else { - // was really deleted and can only be deleted if father is not in use in another element - if (($fatherGetsDeleted && count($elementsInUse) == 0) || !$fatherGetsDeleted) { - $json = $this->removeField($inlineField['inlineParent'], 'tx_mask_' . $inlineField['key'], - $json); + if (!$fatherGetsDeleted) { + $json = $this->removeField( + $inlineField['inlineParent'], + 'tx_mask_' . $inlineField['key'], + $json + ); + } elseif ($fatherGetsDeleted && count($elementsInUse) === 0) { + $json = $this->removeField( + $inlineField['inlineParent'], + 'tx_mask_' . $inlineField['key'], + $json + ); } } } @@ -424,11 +431,10 @@ private function removeField($table, $field, $json, $remainingFields = array()) // then delete the field, if it is not in use in another element if (count($elementsInUse) < 1) { - unset($json[$table]['tca'][$field]); - unset($json[$table]['sql'][$field]); + unset($json[$table]['tca'][$field], $json[$table]['sql'][$field]); // If field is of type file, also delete entry in sys_file_reference - if ($this->fieldHelper->getFormType($field) == 'File') { + if ($this->fieldHelper->getFormType($field) === 'File') { unset($json['sys_file_reference']['sql'][$field]); $json = $this->cleanTable('sys_file_reference', $json); } @@ -444,7 +450,7 @@ private function removeField($table, $field, $json, $remainingFields = array()) * @return array * @author Benjamin Butschell */ - private function cleanTable($table, $json) + private function cleanTable($table, $json): array { if ($json[$table]['tca'] && count($json[$table]['tca']) < 1) { unset($json[$table]['tca']); @@ -463,7 +469,7 @@ private function cleanTable($table, $json) * * @param array $content */ - public function update($content) + public function update($content): void { $this->remove($content['type'], $content['orgkey'], $content['elements']['columns']); $this->add($content); @@ -471,16 +477,17 @@ public function update($content) /** * Sorts the json entries - * @param array $json + * @param array $array + * @return void */ - private function sortJson(array &$array) + private function sortJson(array &$array): void { // check if array is not a hash table, because we only want to sort hash tables if ( [] === $array || !(array_keys($array) !== range(0, count($array) - 1)) ) { - return false; + return; } ksort($array); diff --git a/Classes/Domain/Service/SettingsService.php b/Classes/Domain/Service/SettingsService.php index 4cc101d6..16588590 100644 --- a/Classes/Domain/Service/SettingsService.php +++ b/Classes/Domain/Service/SettingsService.php @@ -27,6 +27,8 @@ * This copyright notice MUST APPEAR in all copies of the script! * ************************************************************* */ +use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationExtensionNotConfiguredException; +use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationPathDoesNotExistException; use TYPO3\CMS\Core\Configuration\ExtensionConfiguration; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -46,13 +48,6 @@ class SettingsService */ protected $settings = array(); - /** - * Contains the settings of the typoscript - * - * @var array - */ - protected $typoscriptSettings; - /** * Contains the settings of the $_EXTCONF * @@ -63,8 +58,10 @@ class SettingsService /** * Returns the settings * @return array + * @throws ExtensionConfigurationExtensionNotConfiguredException + * @throws ExtensionConfigurationPathDoesNotExistException */ - public function get() + public function get(): array { if ($this->extSettings === null) { $this->extSettings = $this->getExtSettings(); @@ -73,6 +70,11 @@ public function get() return $this->extSettings; } + /** + * @return array + * @throws ExtensionConfigurationExtensionNotConfiguredException + * @throws ExtensionConfigurationPathDoesNotExistException + */ protected function getExtSettings(): array { return GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('mask'); diff --git a/Classes/ExpressionLanguage/MaskContentTypeConditionFunctionsProvider.php b/Classes/ExpressionLanguage/MaskContentTypeConditionFunctionsProvider.php index 9c098421..942717b9 100644 --- a/Classes/ExpressionLanguage/MaskContentTypeConditionFunctionsProvider.php +++ b/Classes/ExpressionLanguage/MaskContentTypeConditionFunctionsProvider.php @@ -32,6 +32,7 @@ public function getFunctions(): array /** * @return ExpressionFunction + * @noinspection PhpComposerExtensionStubsInspection */ protected function getMaskContentElementFunction(): ExpressionFunction { @@ -80,7 +81,7 @@ protected function getMaskContentElementFunction(): ExpressionFunction // Content element is loaded via ajax (inline) $parsedBody = $request->getParsedBody(); if (isset($parsedBody['ajax']['context'])) { - $parsedContext = json_decode($parsedBody['ajax']['context'], true); + $parsedContext = json_decode($parsedBody['ajax']['context'], true, 512, JSON_THROW_ON_ERROR); if (isset($parsedContext['config']['overrideChildTca']['columns']['CType']['config']['default'])) { return $parsedContext['config']['overrideChildTca']['columns']['CType']['config']['default'] === 'mask_' . $value; } diff --git a/Classes/Fluid/FluidTemplateContentObject.php b/Classes/Fluid/FluidTemplateContentObject.php index 2c78fe86..70bcff01 100755 --- a/Classes/Fluid/FluidTemplateContentObject.php +++ b/Classes/Fluid/FluidTemplateContentObject.php @@ -34,6 +34,7 @@ use MASK\Mask\Helper\InlineHelper; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Annotation\Inject; +use TYPO3\CMS\Extbase\Object\Exception; use TYPO3\CMS\Extbase\Object\ObjectManager; class FluidTemplateContentObject extends \TYPO3\CMS\Frontend\ContentObject\FluidTemplateContentObject @@ -42,7 +43,7 @@ class FluidTemplateContentObject extends \TYPO3\CMS\Frontend\ContentObject\Fluid /** * InlineHelper * - * @var \MASK\Mask\Helper\InlineHelper + * @var InlineHelper * @Inject() */ protected $inlineHelper; @@ -50,7 +51,7 @@ class FluidTemplateContentObject extends \TYPO3\CMS\Frontend\ContentObject\Fluid /** * storageRepository * - * @var \MASK\Mask\Domain\Repository\StorageRepository + * @var StorageRepository * @Inject() */ protected $storageRepository; @@ -59,10 +60,11 @@ class FluidTemplateContentObject extends \TYPO3\CMS\Frontend\ContentObject\Fluid * Change variables for view * * @param array $conf Configuration - * @return void + * @return array + * @throws Exception * @author Benjamin Butschell */ - protected function getContentObjectVariables(array $conf = array()) + protected function getContentObjectVariables(array $conf = array()): array { // Call Parent Function to maintain core functions $variables = parent::getContentObjectVariables($conf); diff --git a/Classes/Helper/FieldHelper.php b/Classes/Helper/FieldHelper.php index a954be88..1466556f 100644 --- a/Classes/Helper/FieldHelper.php +++ b/Classes/Helper/FieldHelper.php @@ -27,6 +27,9 @@ * This copyright notice MUST APPEAR in all copies of the script! * ************************************************************* */ +use MASK\Mask\Domain\Repository\StorageRepository; +use TYPO3\CMS\Core\Utility\GeneralUtility; + /** * Methods for types of fields in mask (string, rte, repeating, ...) * @@ -38,17 +41,17 @@ class FieldHelper /** * StorageRepository * - * @var \MASK\Mask\Domain\Repository\StorageRepository + * @var StorageRepository */ protected $storageRepository; /** - * @param \MASK\Mask\Domain\Repository\StorageRepository $storageRepository + * @param StorageRepository $storageRepository */ - public function __construct(\MASK\Mask\Domain\Repository\StorageRepository $storageRepository = null) + public function __construct(StorageRepository $storageRepository = null) { if (!$storageRepository) { - $this->storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Domain\\Repository\\StorageRepository'); + $this->storageRepository = GeneralUtility::makeInstance(StorageRepository::class); } else { $this->storageRepository = $storageRepository; } @@ -62,7 +65,7 @@ public function __construct(\MASK\Mask\Domain\Repository\StorageRepository $stor * @return array elements in use * @author Benjamin Butschell */ - public function getElementsWhichUseField($key, $type = 'tt_content') + public function getElementsWhichUseField($key, $type = 'tt_content'): array { $storage = $this->storageRepository->load(); @@ -71,7 +74,7 @@ public function getElementsWhichUseField($key, $type = 'tt_content') foreach ($storage[$type]['elements'] as $element) { if ($element['columns']) { foreach ($element['columns'] as $column) { - if ($column == $key) { + if ($column === $key) { $elementsInUse[] = $element; } } @@ -90,13 +93,13 @@ public function getElementsWhichUseField($key, $type = 'tt_content') * @return string Label * @author Benjamin Butschell */ - public function getLabel($elementKey, $fieldKey, $type = 'tt_content') + public function getLabel($elementKey, $fieldKey, $type = 'tt_content'): string { $storage = $this->storageRepository->load(); $fieldIndex = -1; if ($storage[$type]['elements'][$elementKey]['columns'] && count($storage[$type]['elements'][$elementKey]['columns']) > 0) { foreach ($storage[$type]['elements'][$elementKey]['columns'] as $index => $column) { - if ($column == $fieldKey) { + if ($column === $fieldKey) { $fieldIndex = $index; } } @@ -118,9 +121,10 @@ public function getLabel($elementKey, $fieldKey, $type = 'tt_content') * @return string formType * @author Benjamin Butschell */ - public function getFormType($fieldKey, $elementKey = '', $type = 'tt_content') + public function getFormType($fieldKey, $elementKey = '', $type = 'tt_content'): string { $formType = 'String'; + $element = []; // Load element and TCA of field if ($elementKey) { @@ -137,7 +141,7 @@ public function getFormType($fieldKey, $elementKey = '', $type = 'tt_content') } // if field is in inline table or $GLOBALS["TCA"] is not yet filled, load tca from json - if (!in_array($type, array('tt_content', 'pages')) || $tca == null) { + if ($tca === null || !in_array($type, array('tt_content', 'pages'))) { $tca = $this->storageRepository->loadField($type, $fieldKey); if (!$tca['config']) { $tca = $this->storageRepository->loadField($type, 'tx_mask_' . $fieldKey); @@ -147,24 +151,23 @@ public function getFormType($fieldKey, $elementKey = '', $type = 'tt_content') $tcaType = $tca['config']['type']; $evals = explode(',', $tca['config']['eval']); - if ($tca['options'] == 'file') { + if ($tca['options'] === 'file') { $formType = 'File'; } // And decide via different tca settings which formType it is switch ($tcaType) { case 'input': - $formType = 'String'; - if (array_search(strtolower('int'), $evals) !== false) { + if (in_array(strtolower('int'), $evals, true)) { $formType = 'Integer'; } else { - if (array_search(strtolower('double2'), $evals) !== false) { + if (in_array(strtolower('double2'), $evals, true)) { $formType = 'Float'; } else { - if (array_search(strtolower('date'), $evals) !== false) { + if (in_array(strtolower('date'), $evals, true)) { $formType = 'Date'; } else { - if (array_search(strtolower('datetime'), $evals) !== false) { + if (in_array(strtolower('datetime'), $evals, true)) { $formType = 'Datetime'; } else { if (isset($tca['config']['renderType']) && $tca['config']['renderType'] === 'inputLink') { @@ -184,7 +187,7 @@ public function getFormType($fieldKey, $elementKey = '', $type = 'tt_content') $fieldNumberKey = -1; if (is_array($element['columns'])) { foreach ($element['columns'] as $numberKey => $column) { - if ($column == $fieldKey) { + if ($column === $fieldKey) { $fieldNumberKey = $numberKey; } } @@ -192,7 +195,7 @@ public function getFormType($fieldKey, $elementKey = '', $type = 'tt_content') if ($fieldNumberKey >= 0) { $option = $element['options'][$fieldNumberKey]; - if ($option == 'rte') { + if ($option === 'rte') { $formType = 'Richtext'; } else { $formType = 'Text'; @@ -218,22 +221,11 @@ public function getFormType($fieldKey, $elementKey = '', $type = 'tt_content') case 'select': $formType = 'Select'; break; - case 'group': - break; - case 'none': - break; - case 'passthrough': - break; - case 'user': - break; - case 'flex': - break; case 'inline': - $formType = 'Inline'; - if ($tca['config']['foreign_table'] == 'sys_file_reference') { + if ($tca['config']['foreign_table'] === 'sys_file_reference') { $formType = 'File'; } else { - if ($tca['config']['foreign_table'] == 'tt_content') { + if ($tca['config']['foreign_table'] === 'tt_content') { $formType = 'Content'; } else { $formType = 'Inline'; @@ -243,6 +235,11 @@ public function getFormType($fieldKey, $elementKey = '', $type = 'tt_content') case 'tab': $formType = 'Tab'; break; + case 'group': + case 'none': + case 'passthrough': + case 'user': + case 'flex': default: break; } @@ -254,11 +251,11 @@ public function getFormType($fieldKey, $elementKey = '', $type = 'tt_content') * * @param string $fieldKey key of field * @param string $elementKey key of element + * @param bool $excludeInlineFields * @return string $fieldType returns fieldType or null if not found - * @return string $excludeInlineFields only search in tt_content and pages * @author Benjamin Butschell */ - public function getFieldType($fieldKey, $elementKey = '', $excludeInlineFields = false) + public function getFieldType($fieldKey, $elementKey = '', $excludeInlineFields = false): string { $storage = $this->storageRepository->load(); @@ -280,10 +277,10 @@ public function getFieldType($fieldKey, $elementKey = '', $excludeInlineFields = // if this is the element we search for, or no special element was given, // and the element has columns and the fieldType wasn't found yet - if (($element['key'] == $elementKey || $elementKey == '') && $element['columns'] && !$found) { + if (($element['key'] === $elementKey || $elementKey === '') && $element['columns'] && !$found) { foreach ($element['columns'] as $column) { - if ($column == $fieldKey && !$found) { + if ($column === $fieldKey && !$found) { $fieldType = $type; $found = true; } @@ -307,7 +304,7 @@ public function getFieldType($fieldKey, $elementKey = '', $excludeInlineFields = * @param string $type elementtype * @return array fields */ - public function getFieldsByType($key, $type) + public function getFieldsByType($key, $type): array { $storage = $this->storageRepository->load(); if (empty($storage[$type]) || empty($storage[$type]['tca'])) { diff --git a/Classes/Helper/InlineHelper.php b/Classes/Helper/InlineHelper.php index e2515354..5f407ed4 100644 --- a/Classes/Helper/InlineHelper.php +++ b/Classes/Helper/InlineHelper.php @@ -27,11 +27,17 @@ * This copyright notice MUST APPEAR in all copies of the script! * ************************************************************* */ +use MASK\Mask\Domain\Repository\BackendLayoutRepository; +use MASK\Mask\Domain\Repository\StorageRepository; use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Annotation\Inject; use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction; +use TYPO3\CMS\Extbase\Object\Exception; +use TYPO3\CMS\Extbase\Object\ObjectManager; +use MASK\Mask\Helper\FieldHelper; +use TYPO3\CMS\Core\Resource\FileRepository; /** * Methods for working with inline fields (IRRE) @@ -42,7 +48,7 @@ class InlineHelper { /** - * @var TYPO3\CMS\Extbase\Object\ObjectManager + * @var ObjectManager * @Inject() */ protected $objectManager; @@ -50,26 +56,25 @@ class InlineHelper /** * StorageRepository * - * @var \MASK\Mask\Domain\Repository\StorageRepository + * @var StorageRepository */ protected $storageRepository; /** * BackendLayoutRepository * - * @var \MASK\Mask\Domain\Repository\BackendLayoutRepository + * @var BackendLayoutRepository * @Inject() */ protected $backendLayoutRepository; - /** - * @param \MASK\Mask\Domain\Repository\StorageRepository $storageRepository + * @param StorageRepository $storageRepository */ - public function __construct(\MASK\Mask\Domain\Repository\StorageRepository $storageRepository = null) + public function __construct(StorageRepository $storageRepository = null) { if (!$storageRepository) { - $this->storageRepository = GeneralUtility::makeInstance('MASK\\Mask\\Domain\\Repository\\StorageRepository'); + $this->storageRepository = GeneralUtility::makeInstance(StorageRepository::class); } else { $this->storageRepository = $storageRepository; } @@ -80,9 +85,10 @@ public function __construct(\MASK\Mask\Domain\Repository\StorageRepository $stor * * @param array $data * @param string $table + * @throws Exception * @author Benjamin Butschell */ - public function addFilesToData(&$data, $table = 'tt_content') + public function addFilesToData(&$data, $table = 'tt_content'): void { if ($data['_LOCALIZED_UID']) { $uid = $data['_LOCALIZED_UID']; @@ -95,14 +101,14 @@ public function addFilesToData(&$data, $table = 'tt_content') if (!is_numeric($uid)) { return; } - $fieldHelper = GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); + $fieldHelper = GeneralUtility::makeInstance(FieldHelper::class); if (!$this->objectManager) { - $this->objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager'); + $this->objectManager = GeneralUtility::makeInstance(ObjectManager::class); } $storage = $this->storageRepository->load(); - /* @var $fileRepository \TYPO3\CMS\Core\Resource\FileRepository */ - $fileRepository = $this->objectManager->get("TYPO3\CMS\Core\Resource\FileRepository"); + $fileRepository = $this->objectManager->get(FileRepository::class); + $contentFields = array('media', 'image', 'assets'); if ($storage[$table]['tca']) { foreach ($storage[$table]['tca'] as $fieldKey => $field) { @@ -111,7 +117,7 @@ public function addFilesToData(&$data, $table = 'tt_content') } if ($contentFields) { foreach ($contentFields as $fieldKey) { - if ($fieldHelper->getFormType($fieldKey, '', $table) == 'File') { + if ($fieldHelper->getFormType($fieldKey, '', $table) === 'File') { $data[$fieldKey] = $fileRepository->findByRelation($table, $fieldKey, $uid); } } @@ -124,12 +130,13 @@ public function addFilesToData(&$data, $table = 'tt_content') * @param array $data * @param string $table * @param string $cType + * @throws \Exception * @author Benjamin Butschell */ - public function addIrreToData(&$data, $table = 'tt_content', $cType = '') + public function addIrreToData(&$data, $table = 'tt_content', $cType = ''): void { - if ($cType == '') { + if ($cType === '') { $cType = $data['CType']; } @@ -138,10 +145,10 @@ public function addIrreToData(&$data, $table = 'tt_content', $cType = '') $elementFields = []; // if the table is tt_content, load the element and all its columns - if ($table == 'tt_content') { + if ($table === 'tt_content') { $element = $this->storageRepository->loadElement($table, str_replace('mask_', '', $cType)); $elementFields = $element['columns']; - } elseif ($table == 'pages') { + } elseif ($table === 'pages') { // if the table is pages, then load the pid if (isset($data['uid'])) { @@ -180,13 +187,19 @@ public function addIrreToData(&$data, $table = 'tt_content', $cType = '') $type = $fieldHelper->getFormType($fieldKey, $cType, $table); // if it is of type inline and has to be filled (IRRE, FAL) - if ($type == 'Inline') { + if ($type === 'Inline') { $elements = $this->getInlineElements($data, $fieldKeyPrefix, $cType, 'parentid', $table); $data[$fieldKeyPrefix] = $elements; // or if it is of type Content (Nested Content) and has to be filled - } elseif ($type == 'Content') { - $elements = $this->getInlineElements($data, $fieldKeyPrefix, $cType, $fieldKeyPrefix . '_parent', - 'tt_content', 'tt_content'); + } elseif ($type === 'Content') { + $elements = $this->getInlineElements( + $data, + $fieldKeyPrefix, + $cType, + $fieldKeyPrefix . '_parent', + 'tt_content', + 'tt_content' + ); $data[$fieldKeyPrefix] = $elements; } } @@ -203,6 +216,8 @@ public function addIrreToData(&$data, $table = 'tt_content', $cType = '') * @param string $parenttable The table where the parent element is stored * @param string $childTable name of childtable * @return array all irre elements of this attribut + * @throws Exception + * @throws \Exception * @author Benjamin Butschell */ public function getInlineElements( @@ -212,30 +227,21 @@ public function getInlineElements( $parentFieldName = 'parentid', $parenttable = 'tt_content', $childTable = null - ) { + ): array { // if the name of the child table is not explicitely given, take field key if (!$childTable) { $childTable = $name; } - // If this method is called in backend, there is no $GLOBALS['TSFE'] - if (TYPO3_MODE == 'FE' && isset($GLOBALS['TSFE']->sys_language_uid)) { - $sysLangUid = $GLOBALS['TSFE']->sys_language_uid; - $enableFields = $GLOBALS['TSFE']->cObj->enableFields($childTable); - } else { - $sysLangUid = $data['sys_language_uid']; - $enableFields = ' AND ' . $childTable . '.deleted = 0'; - } - // by default, the uid of the parent is $data["uid"] $parentUid = $data['uid']; - if ($GLOBALS['TSFE']->sys_language_uid != 0 && $data['_LOCALIZED_UID'] != '') { + if ($GLOBALS['TSFE']->sys_language_uid !== 0 && $data['_LOCALIZED_UID'] !== '') { $parentUid = $data['_LOCALIZED_UID']; } $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($childTable); - if (TYPO3_MODE == 'BE') { + if (TYPO3_MODE === 'BE') { $queryBuilder ->getRestrictions() ->removeAll() @@ -257,7 +263,7 @@ public function getInlineElements( // and recursively add them to an array $elements = array(); foreach ($rows as $element) { - if (TYPO3_MODE == 'FE') { + if (TYPO3_MODE === 'FE') { $GLOBALS['TSFE']->sys_page->versionOL($childTable, $element); } else { $element = BackendUtility::getRecordWSOL($childTable, $element['uid']); diff --git a/Classes/Hooks/PageLayoutViewDrawItem.php b/Classes/Hooks/PageLayoutViewDrawItem.php index fe6d36ef..64a056dd 100644 --- a/Classes/Hooks/PageLayoutViewDrawItem.php +++ b/Classes/Hooks/PageLayoutViewDrawItem.php @@ -34,10 +34,17 @@ use MASK\Mask\Domain\Service\SettingsService; use MASK\Mask\Helper\InlineHelper; use MASK\Mask\Utility\GeneralUtility as MaskUtility; +use TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException; use TYPO3\CMS\Backend\Routing\UriBuilder; +use TYPO3\CMS\Backend\View\PageLayoutView; +use TYPO3\CMS\Backend\View\PageLayoutViewDrawItemHookInterface; +use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationExtensionNotConfiguredException; +use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationPathDoesNotExistException; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Extbase\Object\Exception; use TYPO3\CMS\Extbase\Object\ObjectManager; +use TYPO3\CMS\Extbase\Utility\LocalizationUtility; use TYPO3\CMS\Fluid\View\StandaloneView; /** @@ -47,7 +54,7 @@ * @package MASK * @subpackage mask */ -class PageLayoutViewDrawItem implements \TYPO3\CMS\Backend\View\PageLayoutViewDrawItemHookInterface +class PageLayoutViewDrawItem implements PageLayoutViewDrawItemHookInterface { /** @@ -68,7 +75,7 @@ class PageLayoutViewDrawItem implements \TYPO3\CMS\Backend\View\PageLayoutViewDr /** * SettingsService * - * @var \MASK\Mask\Domain\Service\SettingsService + * @var SettingsService */ protected $settingsService; @@ -82,27 +89,30 @@ class PageLayoutViewDrawItem implements \TYPO3\CMS\Backend\View\PageLayoutViewDr /** * Preprocesses the preview rendering of a content element. * - * @param \TYPO3\CMS\Backend\View\PageLayoutView $parentObject Calling parent object + * @param PageLayoutView $parentObject Calling parent object * @param boolean $drawItem Whether to draw the item using the default functionalities * @param string $headerContent Header content * @param string $itemContent Item content * @param array $row Record row of tt_content * @return void - * @throws \TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException - * @throws \TYPO3\CMS\Extbase\Object\Exception + * @throws RouteNotFoundException + * @throws ExtensionConfigurationExtensionNotConfiguredException + * @throws ExtensionConfigurationPathDoesNotExistException + * @throws Exception + * @noinspection ReferencingObjectsInspection */ public function preProcess( - \TYPO3\CMS\Backend\View\PageLayoutView &$parentObject, + PageLayoutView &$parentObject, &$drawItem, &$headerContent, &$itemContent, array &$row - ) { + ): void { $this->settingsService = GeneralUtility::makeInstance(SettingsService::class); $this->extSettings = $this->settingsService->get(); // only render special backend preview if it is a mask element - if (substr($row['CType'], 0, 4) === 'mask') { + if (strpos($row['CType'], 'mask') === 0) { $elementKey = substr($row['CType'], 5); # fallback to prevent breaking change @@ -142,7 +152,7 @@ public function preProcess( // if the elementLabel contains LLL: then translate it $elementLabel = $element['label']; if (GeneralUtility::isFirstPartOfStr($elementLabel, 'LLL:')) { - $elementLabel = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate($elementLabel, 'mask'); + $elementLabel = LocalizationUtility::translate($elementLabel, 'mask'); } // Render everything @@ -172,8 +182,10 @@ public function preProcess( * * @param int $uid of content element to get * @return array with all properties of given content element uid + * @throws Exception + * @throws \Exception */ - protected function getContentObject($uid) + protected function getContentObject($uid): array { $contentTable = 'tt_content'; $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($contentTable); diff --git a/Classes/Hooks/PageLayoutViewHook.php b/Classes/Hooks/PageLayoutViewHook.php index cdc1b616..f27d956a 100644 --- a/Classes/Hooks/PageLayoutViewHook.php +++ b/Classes/Hooks/PageLayoutViewHook.php @@ -14,7 +14,7 @@ class PageLayoutViewHook * @param PageLayoutView $parentObject * @return bool */ - public function contentIsUsed(array $params, PageLayoutView $parentObject) + public function contentIsUsed(array $params, PageLayoutView $parentObject): bool { if ($params['used']) { return true; diff --git a/Classes/Imaging/IconProvider/ContentElementIconProvider.php b/Classes/Imaging/IconProvider/ContentElementIconProvider.php index 54b37a36..0af7131b 100644 --- a/Classes/Imaging/IconProvider/ContentElementIconProvider.php +++ b/Classes/Imaging/IconProvider/ContentElementIconProvider.php @@ -3,9 +3,17 @@ namespace MASK\Mask\Imaging\IconProvider; +use InvalidArgumentException; +use MASK\Mask\Domain\Repository\StorageRepository; +use MASK\Mask\Domain\Service\SettingsService; +use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationExtensionNotConfiguredException; +use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationPathDoesNotExistException; use TYPO3\CMS\Core\Imaging\Icon; use TYPO3\CMS\Core\Imaging\IconProviderInterface; +use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\PathUtility; +use TYPO3\CMS\Extbase\Object\Exception; +use TYPO3\CMS\Extbase\Object\ObjectManager; /* * ************************************************************* * Copyright notice @@ -41,7 +49,7 @@ class ContentElementIconProvider implements IconProviderInterface /** * StorageRepository - * @var \MASK\Mask\Domain\Repository\StorageRepository + * @var StorageRepository */ protected $storageRepository; @@ -54,7 +62,7 @@ class ContentElementIconProvider implements IconProviderInterface /** * SettingsService * - * @var \MASK\Mask\Domain\Service\SettingsService + * @var SettingsService */ protected $settingsService; @@ -69,18 +77,23 @@ class ContentElementIconProvider implements IconProviderInterface * * @param Icon $icon * @param array $options + * @throws ExtensionConfigurationExtensionNotConfiguredException + * @throws ExtensionConfigurationPathDoesNotExistException + * @throws Exception * @author Benjamin Butschell */ - public function prepareIconMarkup(Icon $icon, array $options = array()) + public function prepareIconMarkup(Icon $icon, array $options = array()): void { // error checking if (empty($options['contentElementKey'])) { - throw new \InvalidArgumentException('The option "contentElementKey" is required and must not be empty', - 1440754978); + throw new InvalidArgumentException( + 'The option "contentElementKey" is required and must not be empty', + 1440754978 + ); } - $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager'); - $this->storageRepository = $this->objectManager->get("MASK\Mask\Domain\Repository\StorageRepository"); - $this->settingsService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Domain\\Service\\SettingsService'); + $objectManager = GeneralUtility::makeInstance(ObjectManager::class); + $this->storageRepository = $objectManager->get(StorageRepository::class); + $this->settingsService = GeneralUtility::makeInstance(SettingsService::class); $this->extSettings = $this->settingsService->get(); $this->contentElement = $this->storageRepository->loadElement('tt_content', $options['contentElementKey']); $icon->setMarkup($this->generateMarkup($icon, $options)); @@ -91,20 +104,21 @@ public function prepareIconMarkup(Icon $icon, array $options = array()) * @param Icon $icon * @param array $options * @return string - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @author Benjamin Butschell */ - protected function generateMarkup(Icon $icon, array $options) + protected function generateMarkup(Icon $icon, array $options): string { $previewIconAvailable = $this->isPreviewIconAvailable($options['contentElementKey']); $fontAwesomeKeyAvailable = $this->isFontAwesomeKeyAvailable($this->contentElement); - // decide what kind of icon to render if ($fontAwesomeKeyAvailable) { $color = $this->getColor($this->contentElement); + $styles = []; + if ($color) { $styles[] = 'color: #' . $color; } @@ -138,13 +152,12 @@ protected function generateMarkup(Icon $icon, array $options) * @return boolean * @author Benjamin Butschell */ - protected function isPreviewIconAvailable($key) + protected function isPreviewIconAvailable($key): bool { if (file_exists(PATH_site . $this->getPreviewIconPath($key))) { return true; - } else { - return false; } + return false; } /** @@ -154,9 +167,9 @@ protected function isPreviewIconAvailable($key) * @todo implement * @author Benjamin Butschell */ - protected function isFontAwesomeKeyAvailable($element) + protected function isFontAwesomeKeyAvailable($element): bool { - return trim($element['icon']) != ''; + return trim($element['icon']) !== ''; } /** @@ -164,7 +177,7 @@ protected function isFontAwesomeKeyAvailable($element) * @return string * @author Benjamin Butschell */ - protected function getPreviewIconPath($key) + protected function getPreviewIconPath($key): string { return $this->extSettings['preview'] . $key . '.png'; } @@ -175,7 +188,7 @@ protected function getPreviewIconPath($key) * @return string * @author Benjamin Butschell */ - protected function getFontAwesomeKey($element) + protected function getFontAwesomeKey($element): string { return trim(str_replace('fa-', '', $element['icon'])); } @@ -186,7 +199,7 @@ protected function getFontAwesomeKey($element) * @return string * @author Benjamin Butschell */ - protected function getColor($element) + protected function getColor($element): string { return trim(str_replace('#', '', $element['color'])); } diff --git a/Classes/ItemsProcFuncs/CTypeList.php b/Classes/ItemsProcFuncs/CTypeList.php index 955ad604..bb042d69 100644 --- a/Classes/ItemsProcFuncs/CTypeList.php +++ b/Classes/ItemsProcFuncs/CTypeList.php @@ -27,6 +27,10 @@ * This copyright notice MUST APPEAR in all copies of the script! * ************************************************************* */ +use MASK\Mask\Domain\Repository\StorageRepository; +use TYPO3\CMS\Core\Utility\GeneralUtility; +use MASK\Mask\Helper\FieldHelper; + /** * Render the allowed CTypes for nested content elements * @author Benjamin Butschell @@ -37,29 +41,31 @@ class CTypeList extends AbstractList /** * StorageRepository * - * @var \MASK\Mask\Domain\Repository\StorageRepository + * @var StorageRepository */ protected $storageRepository; /** * Render the allowed CTypes for nested content elements * @param array $params + * @noinspection PhpComposerExtensionStubsInspection */ - public function itemsProcFunc(&$params) + public function itemsProcFunc(&$params): void { // if this tt_content element is inline element of mask - if ($params['row']['colPos'] == $this->colPos) { - $fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); - $this->storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Domain\\Repository\\StorageRepository'); + if ((int)$params['row']['colPos'] === $this->colPos) { + $fieldHelper = GeneralUtility::makeInstance(FieldHelper::class); + $this->storageRepository = GeneralUtility::makeInstance(StorageRepository::class); + $fieldKey = ''; if (isset($_REQUEST['ajax']['context'])) { - $ajaxContext = json_decode($_REQUEST['ajax']['context']); + $ajaxContext = json_decode($_REQUEST['ajax']['context'], true, 512, JSON_THROW_ON_ERROR); $fieldKey = str_replace('_parent', '', $ajaxContext->config->foreign_field); } else { $fields = $params['row']; foreach ($fields as $key => $field) { // search for the parent field, to get the key of mask field this content element belongs to - if ($this->startsWith($key, 'tx_mask_') && $this->endsWith($key, '_parent') && $field > 0) { + if ($field > 0 && $this->startsWith($key, 'tx_mask_') && $this->endsWith($key, '_parent')) { // if a parent field was found, that is filled with a uid, extract the mask field name from it $fieldKey = str_replace('_parent', '', $key); @@ -91,7 +97,7 @@ public function itemsProcFunc(&$params) // and if other itemsProcFunc from other extension was available (e.g. gridelements), // then call it now and let it render the items if (!empty($params['config']['m_itemsProcFunc'])) { - \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($params['config']['m_itemsProcFunc'], $params, + GeneralUtility::callUserFunction($params['config']['m_itemsProcFunc'], $params, $this); } } @@ -103,7 +109,7 @@ public function itemsProcFunc(&$params) * @param string $needle * @return bool */ - protected function startsWith($haystack, $needle) + protected function startsWith($haystack, $needle): bool { // search backwards starting from haystack length characters from the end return $needle === '' || strrpos($haystack, $needle, -strlen($haystack)) !== false; @@ -115,7 +121,7 @@ protected function startsWith($haystack, $needle) * @param string $needle * @return bool */ - protected function endsWith($haystack, $needle) + protected function endsWith($haystack, $needle): bool { // search forward starting from end minus needle length characters return $needle === '' || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, diff --git a/Classes/ItemsProcFuncs/ColPosList.php b/Classes/ItemsProcFuncs/ColPosList.php index bf339e33..07e8d1d6 100644 --- a/Classes/ItemsProcFuncs/ColPosList.php +++ b/Classes/ItemsProcFuncs/ColPosList.php @@ -27,6 +27,9 @@ * This copyright notice MUST APPEAR in all copies of the script! * ************************************************************* */ +use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Extbase\Utility\LocalizationUtility; + /** * Render the allowed colPos for nested content elements * @author Benjamin Butschell @@ -38,25 +41,29 @@ class ColPosList extends AbstractList * Render the allowed colPos for nested content elements * @param array $params */ - public function itemsProcFunc(&$params) + public function itemsProcFunc(&$params): void { // if this tt_content element is inline element of mask - if ($params['row']['colPos'] == $this->colPos) { + if ((int)$params['row']['colPos'] === $this->colPos) { // only allow mask nested element column $params['items'] = array( array( - \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('mask_content_colpos', 'mask'), + LocalizationUtility::translate('mask_content_colpos', 'mask'), $this->colPos, null, null ) ); - } else { // if it is not inline tt_content element + } else { + // if it is not inline tt_content element // and if other itemsProcFunc from other extension was available (e.g. gridelements), // then call it now and let it render the items if (!empty($params['config']['m_itemsProcFunc'])) { - \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($params['config']['m_itemsProcFunc'], $params, - $this); + GeneralUtility::callUserFunction( + $params['config']['m_itemsProcFunc'], + $params, + $this + ); } } } diff --git a/Classes/Utility/GeneralUtility.php b/Classes/Utility/GeneralUtility.php index 6a336bb8..b94092c5 100755 --- a/Classes/Utility/GeneralUtility.php +++ b/Classes/Utility/GeneralUtility.php @@ -27,8 +27,8 @@ * This copyright notice MUST APPEAR in all copies of the script! * ************************************************************* */ +use MASK\Mask\Domain\Repository\StorageRepository; use TYPO3\CMS\Core\Core\Environment; -use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; use TYPO3\CMS\Core\Utility\GeneralUtility as CoreUtility; /** @@ -42,17 +42,17 @@ class GeneralUtility /** * StorageRepository * - * @var \MASK\Mask\Domain\Repository\StorageRepository + * @var StorageRepository */ protected $storageRepository; /** - * @param \MASK\Mask\Domain\Repository\StorageRepository $storageRepository + * @param StorageRepository $storageRepository */ - public function __construct(\MASK\Mask\Domain\Repository\StorageRepository $storageRepository = null) + public function __construct(StorageRepository $storageRepository = null) { if (!$storageRepository) { - $this->storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Domain\\Repository\\StorageRepository'); + $this->storageRepository = CoreUtility::makeInstance(StorageRepository::class); } else { $this->storageRepository = $storageRepository; } @@ -67,16 +67,16 @@ public function __construct(\MASK\Mask\Domain\Repository\StorageRepository $stor * @return boolean $evalValue is set * @author Benjamin Butschell */ - public function isEvalValueSet($fieldKey, $evalValue, $type = 'tt_content') + public function isEvalValueSet($fieldKey, $evalValue, $type = 'tt_content'): bool { $storage = $this->storageRepository->load(); $found = false; - if ($storage[$type]['tca'][$fieldKey]['config']['eval'] != '') { + if (isset($storage[$type]['tca'][$fieldKey]['config']['eval'])) { $evals = explode(',', $storage[$type]['tca'][$fieldKey]['config']['eval']); foreach ($evals as $index => $eval) { $evals[$index] = strtolower($eval); } - $found = array_search(strtolower($evalValue), $evals) !== false; + $found = in_array(strtolower($evalValue), $evals, true); } return $found; } @@ -89,12 +89,12 @@ public function isEvalValueSet($fieldKey, $evalValue, $type = 'tt_content') * @return string $rte_transform * @author Benjamin Butschell */ - public function getRteTransformMode($fieldKey, $type = 'tt_content') + public function getRteTransformMode($fieldKey, $type = 'tt_content'): string { $storage = $this->storageRepository->load(); $transformMode = ''; $matches = array(); - if ($storage[$type]['tca'][$fieldKey]['defaultExtras'] != '') { + if (isset($storage[$type]['tca'][$fieldKey]['defaultExtras'])) { $re = "/(rte_transform\\[([a-z=_]+)\\])/"; preg_match($re, $storage[$type]['tca'][$fieldKey]['defaultExtras'], $matches); $transformMode = end($matches); @@ -108,19 +108,20 @@ public function getRteTransformMode($fieldKey, $type = 'tt_content') * @param string $fieldKey TCA Type * @param string $property value to search for * @param string $type elementtype - * @return boolean $evalValue is set + * @return int|null $evalValue is set * @author Benjamin Butschell */ - public function getJsOpenParamValue($fieldKey, $property, $type = 'tt_content') + public function getJsOpenParamValue($fieldKey, $property, $type = 'tt_content'): ?int { $storage = $this->storageRepository->load(); $value = null; - $windowOpenParameters = $storage[$type]['tca'][$fieldKey]['config']['fieldControl']['linkPopup']['options']['windowOpenParameters']; - if ($windowOpenParameters != '') { - $properties = explode(',', $windowOpenParameters); + if (isset($storage[$type]['tca'][$fieldKey]['config']['fieldControl']['linkPopup']['options']['windowOpenParameters'])) { + $properties = explode(',', + $storage[$type]['tca'][$fieldKey]['config']['fieldControl']['linkPopup']['options']['windowOpenParameters'] + ); foreach ($properties as $setProperty) { $keyPair = explode('=', $setProperty); - if ($property == $keyPair[0]) { + if ($property === $keyPair[0]) { $value = $keyPair[1]; break; } @@ -128,7 +129,7 @@ public function getJsOpenParamValue($fieldKey, $property, $type = 'tt_content') } // if nothing was found, set the default values - if ($value == null) { + if ($value === null) { switch ($property) { case 'height': $value = 300; @@ -136,10 +137,8 @@ public function getJsOpenParamValue($fieldKey, $property, $type = 'tt_content') case 'width': $value = 500; break; - case 'status': - $value = 0; - break; case 'menubar': + case 'status': $value = 0; break; case 'scrollbars': @@ -161,14 +160,15 @@ public function getJsOpenParamValue($fieldKey, $property, $type = 'tt_content') * @return boolean $evalValue is set * @author Benjamin Butschell */ - public function isBlindLinkOptionSet($fieldKey, $evalValue, $type = 'tt_content') + public function isBlindLinkOptionSet($fieldKey, $evalValue, $type = 'tt_content'): bool { $storage = $this->storageRepository->load(); $found = false; - $blindLinkOptions = $storage[$type]['tca'][$fieldKey]['config']['fieldControl']['linkPopup']['options']['blindLinkOptions']; - if ($blindLinkOptions != '') { - $evals = explode(',', $blindLinkOptions); - $found = \in_array(strtolower($evalValue), $evals, true); + if (isset($storage[$type]['tca'][$fieldKey]['config']['fieldControl']['linkPopup']['options']['blindLinkOptions'])) { + $evals = explode(',', + $storage[$type]['tca'][$fieldKey]['config']['fieldControl']['linkPopup']['options']['blindLinkOptions'] + ); + $found = in_array(strtolower($evalValue), $evals, true); } return $found; } @@ -176,16 +176,19 @@ public function isBlindLinkOptionSet($fieldKey, $evalValue, $type = 'tt_content' /** * replace keys * + * @param $data + * @param $replace_key + * @param string $key * @return array * @author Gernot Ploiner */ - public function replaceKey($data, $replace_key, $key = '--key--') + public function replaceKey($data, $replace_key, $key = '--key--'): array { foreach ($data as $elem_key => $elem) { if (is_array($elem)) { $data[$elem_key] = $this->replaceKey($elem, $replace_key); } else { - if ($data[$elem_key] == $key) { + if ($data[$elem_key] === $key) { $data[$elem_key] = $replace_key; } } @@ -196,21 +199,19 @@ public function replaceKey($data, $replace_key, $key = '--key--') /** * Searches an array of strings and returns the first string, that is not a tab * @param array $fields - * @return $string + * @return string $string */ - public function getFirstNoneTabField($fields) + public function getFirstNoneTabField($fields): string { if (count($fields)) { $potentialFirst = $fields[0]; if (strpos($potentialFirst, '--div--') !== false) { unset($fields[0]); return $this->getFirstNoneTabField($fields); - } else { - return $potentialFirst; } - } else { - return ''; + return $potentialFirst; } + return ''; } /** @@ -218,13 +219,13 @@ public function getFirstNoneTabField($fields) * @param array $haystack * @return array */ - public function removeBlankOptions($haystack) + public function removeBlankOptions($haystack): array { foreach ($haystack as $key => $value) { if (is_array($value)) { $haystack[$key] = $this->removeBlankOptions($haystack[$key]); } - if ((is_array($haystack[$key]) && empty($haystack[$key])) || (is_string($haystack[$key]) && !strlen($haystack[$key]))) { + if ((is_array($haystack[$key]) && empty($haystack[$key])) || (is_string($haystack[$key]) && $haystack[$key] === '')) { unset($haystack[$key]); } } @@ -256,8 +257,7 @@ public static function getTemplatePath( ) { $fileName = CoreUtility::underscoredToUpperCamelCase($elementKey); } else { - if (file_exists($path . ucfirst($elementKey) . $fileExtension) - ) { + if (file_exists($path . ucfirst($elementKey) . $fileExtension)) { $fileName = ucfirst($elementKey); } else { if (file_exists($path . $elementKey . $fileExtension)) { diff --git a/Classes/ViewHelpers/CTypesViewHelper.php b/Classes/ViewHelpers/CTypesViewHelper.php index 5b6a1e17..f71bbdc7 100644 --- a/Classes/ViewHelpers/CTypesViewHelper.php +++ b/Classes/ViewHelpers/CTypesViewHelper.php @@ -3,6 +3,8 @@ namespace MASK\Mask\ViewHelpers; +use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Extbase\Utility\LocalizationUtility; use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; /** @@ -24,22 +26,21 @@ class CTypesViewHelper extends AbstractViewHelper * @return array $items an array with all content element cTypes * @author Benjamin Butschell */ - public function render() + public function render(): array { $items = array(); $cTypes = $GLOBALS['TCA']['tt_content']['columns']['CType']['config']['items']; if ($cTypes) { foreach ($cTypes as $type) { if ($type[1] !== '--div--') { - if (\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($type[0], 'LLL:')) { - $items[$type[1]] = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate($type[0], - 'mask') . ' (' . $type[1] . ')'; + if (GeneralUtility::isFirstPartOfStr($type[0], 'LLL:')) { + $items[$type[1]] = LocalizationUtility::translate($type[0], 'mask') . ' (' . $type[1] . ')'; } else { $items[$type[1]] = $type[0] . ' (' . $type[1] . ')'; } } } - return $items; } + return $items; } } diff --git a/Classes/ViewHelpers/ContentViewHelper.php b/Classes/ViewHelpers/ContentViewHelper.php index bff081c2..960bd6c6 100644 --- a/Classes/ViewHelpers/ContentViewHelper.php +++ b/Classes/ViewHelpers/ContentViewHelper.php @@ -3,6 +3,7 @@ namespace MASK\Mask\ViewHelpers; +use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; @@ -18,7 +19,7 @@ class ContentViewHelper extends AbstractViewHelper protected $escapeOutput = false; /** - * @var \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface + * @var ConfigurationManagerInterface */ protected $configurationManager; @@ -27,7 +28,7 @@ class ContentViewHelper extends AbstractViewHelper */ protected $cObj; - public function initializeArguments() + public function initializeArguments(): void { $this->registerArgument('uid', 'integer', 'Uid of the content element', true); } @@ -37,7 +38,7 @@ public function initializeArguments() * * @return string parsed content element */ - public function render() + public function render(): string { $conf = array( 'tables' => 'tt_content', @@ -50,12 +51,12 @@ public function render() /** * Injects Configuration Manager * - * @param \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager + * @param ConfigurationManagerInterface $configurationManager * @return void */ public function injectConfigurationManager( - \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager - ) { + ConfigurationManagerInterface $configurationManager + ): void { $this->configurationManager = $configurationManager; $this->cObj = $this->configurationManager->getContentObject(); } diff --git a/Classes/ViewHelpers/EditLinkViewHelper.php b/Classes/ViewHelpers/EditLinkViewHelper.php index 14e99c10..8f85120e 100644 --- a/Classes/ViewHelpers/EditLinkViewHelper.php +++ b/Classes/ViewHelpers/EditLinkViewHelper.php @@ -24,12 +24,12 @@ class EditLinkViewHelper extends AbstractTagBasedViewHelper /** * @return BackendUserAuthentication */ - protected function getBackendUser() + protected function getBackendUser(): BackendUserAuthentication { return $GLOBALS['BE_USER']; } - public function initializeArguments() + public function initializeArguments(): void { $this->registerArgument('element', 'array', '', true); } diff --git a/Classes/ViewHelpers/ElementCountViewHelper.php b/Classes/ViewHelpers/ElementCountViewHelper.php index db59ccd2..016c2c8e 100644 --- a/Classes/ViewHelpers/ElementCountViewHelper.php +++ b/Classes/ViewHelpers/ElementCountViewHelper.php @@ -3,6 +3,7 @@ namespace MASK\Mask\ViewHelpers; +use MASK\Mask\Domain\Repository\ContentRepository; use TYPO3\CMS\Extbase\Annotation\Inject; use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; @@ -22,12 +23,12 @@ class ElementCountViewHelper extends AbstractViewHelper /** * contentRepository * - * @var \MASK\Mask\Domain\Repository\ContentRepository + * @var ContentRepository * @Inject() */ - protected $contentRepository = null; + protected $contentRepository; - public function initializeArguments() + public function initializeArguments(): void { $this->registerArgument('key', 'string', 'key of content element'); } @@ -37,8 +38,9 @@ public function initializeArguments() * * @return int number of uses of this content element * @author Benjamin Butschell + * @noinspection PhpUndefinedMethodInspection */ - public function render() + public function render(): int { return $this->contentRepository->findByContentType('mask_' . $this->arguments['key'])->count(); } diff --git a/Classes/ViewHelpers/EvalViewHelper.php b/Classes/ViewHelpers/EvalViewHelper.php index 0a3c9b18..54c13e89 100644 --- a/Classes/ViewHelpers/EvalViewHelper.php +++ b/Classes/ViewHelpers/EvalViewHelper.php @@ -3,6 +3,8 @@ namespace MASK\Mask\ViewHelpers; +use MASK\Mask\Helper\FieldHelper; +use MASK\Mask\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Annotation\Inject; use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; @@ -20,7 +22,7 @@ class EvalViewHelper extends AbstractViewHelper /** * Utility * - * @var \MASK\Mask\Utility\GeneralUtility + * @var GeneralUtility * @Inject() */ protected $generalUtility; @@ -28,12 +30,12 @@ class EvalViewHelper extends AbstractViewHelper /** * Utility * - * @var \MASK\Mask\Helper\FieldHelper + * @var FieldHelper * @Inject() */ protected $fieldHelper; - public function initializeArguments() + public function initializeArguments(): void { $this->registerArgument('fieldKey', 'string', 'TCA type', true); $this->registerArgument('elementKey', 'string', 'TCA type', true); @@ -47,15 +49,15 @@ public function initializeArguments() * @return boolean $evalValue is set * @author Benjamin Butschell bb@webprofil.at> */ - public function render() + public function render(): bool { $fieldKey = $this->arguments['fieldKey']; $elementKey = $this->arguments['elementKey']; $evalValue = $this->arguments['evalValue']; $field = $this->arguments['field']; - $this->generalUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Utility\\GeneralUtility'); - $this->fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); + $this->generalUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(GeneralUtility::class); + $this->fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(FieldHelper::class); if ($field) { if ($field['inlineParent']) { diff --git a/Classes/ViewHelpers/FormTypeViewHelper.php b/Classes/ViewHelpers/FormTypeViewHelper.php index 1cc3964f..a5efb110 100644 --- a/Classes/ViewHelpers/FormTypeViewHelper.php +++ b/Classes/ViewHelpers/FormTypeViewHelper.php @@ -3,6 +3,8 @@ namespace MASK\Mask\ViewHelpers; +use MASK\Mask\Helper\FieldHelper; +use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Annotation\Inject; use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; @@ -20,12 +22,12 @@ class FormTypeViewHelper extends AbstractViewHelper /** * FieldHelper * - * @var \MASK\Mask\Helper\FieldHelper + * @var FieldHelper * @Inject() */ protected $fieldHelper; - public function initializeArguments() + public function initializeArguments(): void { $this->registerArgument('elementKey', 'string', 'Key of element', true); $this->registerArgument('fieldKey', 'string', 'Key if field', true); @@ -38,14 +40,13 @@ public function initializeArguments() * @return string formType * @author Benjamin Butschell bb@webprofil.at> */ - public function render() + public function render(): string { $elementKey = $this->arguments['elementKey']; $fieldKey = $this->arguments['fieldKey']; $type = $this->arguments['type']; - $this->fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); - $formType = $this->fieldHelper->getFormType($fieldKey, $elementKey, $type); - return $formType; + $this->fieldHelper = GeneralUtility::makeInstance(FieldHelper::class); + return $this->fieldHelper->getFormType($fieldKey, $elementKey, $type); } } diff --git a/Classes/ViewHelpers/ItemsViewHelper.php b/Classes/ViewHelpers/ItemsViewHelper.php index 032e79e6..d8d016fc 100644 --- a/Classes/ViewHelpers/ItemsViewHelper.php +++ b/Classes/ViewHelpers/ItemsViewHelper.php @@ -15,7 +15,7 @@ */ class ItemsViewHelper extends AbstractViewHelper { - public function initializeArguments() + public function initializeArguments(): void { $this->registerArgument('items', 'array', '', true); } @@ -26,7 +26,7 @@ public function initializeArguments() * @return string items as string * @author Benjamin Butschell bb@webprofil.at> */ - public function render() + public function render(): string { $itemArray = []; diff --git a/Classes/ViewHelpers/JsOpenParamsViewHelper.php b/Classes/ViewHelpers/JsOpenParamsViewHelper.php index e5a2d629..7514ce4b 100644 --- a/Classes/ViewHelpers/JsOpenParamsViewHelper.php +++ b/Classes/ViewHelpers/JsOpenParamsViewHelper.php @@ -3,6 +3,8 @@ namespace MASK\Mask\ViewHelpers; +use MASK\Mask\Helper\FieldHelper; +use MASK\Mask\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Annotation\Inject; use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; @@ -20,7 +22,7 @@ class JsOpenParamsViewHelper extends AbstractViewHelper /** * Utility * - * @var \MASK\Mask\Utility\GeneralUtility + * @var GeneralUtility * @Inject() */ protected $generalUtility; @@ -28,12 +30,12 @@ class JsOpenParamsViewHelper extends AbstractViewHelper /** * Utility * - * @var \MASK\Mask\Helper\FieldHelper + * @var FieldHelper * @Inject() */ protected $fieldHelper; - public function initializeArguments() + public function initializeArguments(): void { $this->registerArgument('fieldKey', 'string', 'TCA Type', true); $this->registerArgument('elementKey', 'string', 'TCA Type', true); @@ -44,18 +46,18 @@ public function initializeArguments() /** * Returns value from jsopenParams * - * @return boolean $evalValue is set + * @return int|null $evalValue is set * @author Benjamin Butschell bb@webprofil.at> */ - public function render() + public function render(): ?int { $fieldKey = $this->arguments['fieldKey']; $elementKey = $this->arguments['elementKey']; $property = $this->arguments['property']; $field = $this->arguments['field']; - $this->generalUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Utility\\GeneralUtility'); - $this->fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); + $this->generalUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(GeneralUtility::class); + $this->fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(FieldHelper::class); if ($field) { if ($field['inlineParent']) { diff --git a/Classes/ViewHelpers/LabelViewHelper.php b/Classes/ViewHelpers/LabelViewHelper.php index a274b81b..50da955c 100644 --- a/Classes/ViewHelpers/LabelViewHelper.php +++ b/Classes/ViewHelpers/LabelViewHelper.php @@ -3,6 +3,8 @@ namespace MASK\Mask\ViewHelpers; +use MASK\Mask\Helper\FieldHelper; +use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Annotation\Inject; use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; @@ -20,12 +22,12 @@ class LabelViewHelper extends AbstractViewHelper /** * FieldHelper * - * @var \MASK\Mask\Helper\FieldHelper + * @var FieldHelper * @Inject() */ protected $fieldHelper; - public function initializeArguments() + public function initializeArguments(): void { $this->registerArgument('elementKey', 'string', 'Key of element', true); $this->registerArgument('fieldKey', 'string', 'Key of field', true); @@ -43,7 +45,7 @@ public function render(): string $field = $this->arguments['field']; $table = $this->arguments['table']; - $this->fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); + $this->fieldHelper = GeneralUtility::makeInstance(FieldHelper::class); // if we have the whole field configuration if ($field) { // check if this field is in an repeating field diff --git a/Classes/ViewHelpers/LinkViewHelper.php b/Classes/ViewHelpers/LinkViewHelper.php index d3493c9c..e7d27961 100644 --- a/Classes/ViewHelpers/LinkViewHelper.php +++ b/Classes/ViewHelpers/LinkViewHelper.php @@ -3,7 +3,10 @@ namespace MASK\Mask\ViewHelpers; +use MASK\Mask\Domain\Service\SettingsService; use MASK\Mask\Utility\GeneralUtility as MaskUtility; +use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationExtensionNotConfiguredException; +use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationPathDoesNotExistException; use TYPO3\CMS\Extbase\Annotation\Inject; use TYPO3\CMS\Extbase\Utility\LocalizationUtility; use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; @@ -30,19 +33,12 @@ class LinkViewHelper extends AbstractViewHelper /** * SettingsService * - * @var \MASK\Mask\Domain\Service\SettingsService + * @var SettingsService * @Inject() */ protected $settingsService; - /** - * settings - * - * @var array - */ - protected $extSettings; - - public function initializeArguments() + public function initializeArguments(): void { $this->registerArgument('data', 'string', 'the parent object'); } @@ -51,6 +47,8 @@ public function initializeArguments() * Checks Links for BE-module * * @return string all irre elements of this attribut + * @throws ExtensionConfigurationExtensionNotConfiguredException + * @throws ExtensionConfigurationPathDoesNotExistException * @author Gernot Ploiner */ public function render(): string diff --git a/Classes/ViewHelpers/LinkoptionViewHelper.php b/Classes/ViewHelpers/LinkoptionViewHelper.php index 74996d11..561a09d5 100644 --- a/Classes/ViewHelpers/LinkoptionViewHelper.php +++ b/Classes/ViewHelpers/LinkoptionViewHelper.php @@ -3,6 +3,8 @@ namespace MASK\Mask\ViewHelpers; +use MASK\Mask\Helper\FieldHelper; +use MASK\Mask\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Annotation\Inject; use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; @@ -20,7 +22,7 @@ class LinkoptionViewHelper extends AbstractViewHelper /** * Utility * - * @var \MASK\Mask\Utility\GeneralUtility + * @var GeneralUtility * @Inject() */ protected $generalUtility; @@ -28,12 +30,12 @@ class LinkoptionViewHelper extends AbstractViewHelper /** * Utility * - * @var \MASK\Mask\Helper\FieldHelper + * @var FieldHelper * @Inject() */ protected $fieldHelper; - public function initializeArguments() + public function initializeArguments(): void { $this->registerArgument('fieldKey', 'string', 'TCA Type', true); $this->registerArgument('elementKey', 'string', 'Key of element', true); @@ -43,20 +45,17 @@ public function initializeArguments() /** * Checks if a $evalValue is set in a field * - * @param string $fieldKey TCA Type - * @param string $elementKey key of the element - * @param string $evalValue value to search for * @return boolean $evalValue is set * @author Benjamin Butschell bb@webprofil.at> */ - public function render() + public function render(): bool { $fieldKey = $this->arguments['fieldKey']; $elementKey = $this->arguments['elementKey']; $evalValue = $this->arguments['evalValue']; - $this->generalUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Utility\\GeneralUtility'); - $this->fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); + $this->generalUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(GeneralUtility::class); + $this->fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(FieldHelper::class); $type = $this->fieldHelper->getFieldType($fieldKey, $elementKey); return $this->generalUtility->isBlindLinkOptionSet($fieldKey, $evalValue, $type); diff --git a/Classes/ViewHelpers/MultiuseViewHelper.php b/Classes/ViewHelpers/MultiuseViewHelper.php index c73153a3..a66f7f5a 100644 --- a/Classes/ViewHelpers/MultiuseViewHelper.php +++ b/Classes/ViewHelpers/MultiuseViewHelper.php @@ -3,6 +3,8 @@ namespace MASK\Mask\ViewHelpers; +use MASK\Mask\Helper\FieldHelper; +use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Annotation\Inject; use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; @@ -20,12 +22,12 @@ class MultiuseViewHelper extends AbstractViewHelper /** * FieldHelper * - * @var \MASK\Mask\Helper\FieldHelper + * @var FieldHelper * @Inject() */ protected $fieldHelper; - public function initializeArguments() + public function initializeArguments(): void { $this->registerArgument('key', 'string', 'TCA Type', true); $this->registerArgument('elementKey', 'string', 'Key of element', true); @@ -37,12 +39,12 @@ public function initializeArguments() * @return array elements in use * @author Benjamin Butschell bb@webprofil.at> */ - public function render() + public function render(): array { $key = $this->arguments['key']; $elementKey = $this->arguments['elementKey']; - $this->fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); + $this->fieldHelper = GeneralUtility::makeInstance(FieldHelper::class); $type = $this->fieldHelper->getFieldType($key, $elementKey); return $this->fieldHelper->getElementsWhichUseField($key, $type); diff --git a/Classes/ViewHelpers/RteTransformViewHelper.php b/Classes/ViewHelpers/RteTransformViewHelper.php index f896d765..33936926 100644 --- a/Classes/ViewHelpers/RteTransformViewHelper.php +++ b/Classes/ViewHelpers/RteTransformViewHelper.php @@ -3,6 +3,8 @@ namespace MASK\Mask\ViewHelpers; +use MASK\Mask\Helper\FieldHelper; +use MASK\Mask\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Annotation\Inject; use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; @@ -20,7 +22,7 @@ class RteTransformViewHelper extends AbstractViewHelper /** * Utility * - * @var \MASK\Mask\Utility\GeneralUtility + * @var GeneralUtility * @Inject() */ protected $generalUtility; @@ -28,12 +30,12 @@ class RteTransformViewHelper extends AbstractViewHelper /** * Utility * - * @var \MASK\Mask\Helper\FieldHelper + * @var FieldHelper * @Inject() */ protected $fieldHelper; - public function initializeArguments() + public function initializeArguments(): void { $this->registerArgument('fieldKey', 'string', 'TCA Type', true); $this->registerArgument('elementKey', 'string', 'TCA Type', true); @@ -52,8 +54,8 @@ public function render() $elementKey = $this->arguments['elementKey']; $field = $this->arguments['field']; - $this->generalUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Utility\\GeneralUtility'); - $this->fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); + $this->generalUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(GeneralUtility::class); + $this->fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(FieldHelper::class); if ($field) { if ($field['inlineParent']) { diff --git a/Classes/ViewHelpers/ShuttleViewHelper.php b/Classes/ViewHelpers/ShuttleViewHelper.php index 8466e5a4..bd2d3ca0 100644 --- a/Classes/ViewHelpers/ShuttleViewHelper.php +++ b/Classes/ViewHelpers/ShuttleViewHelper.php @@ -22,7 +22,7 @@ */ class ShuttleViewHelper extends AbstractViewHelper { - public function initializeArguments() + public function initializeArguments(): void { $this->registerArgument('table', 'string', 'The name of the table', true); $this->registerArgument('field', 'string', 'The name of the field', true); @@ -34,7 +34,7 @@ public function initializeArguments() * @return array all irre elements of this attribut * @author Gernot Ploiner */ - public function render() + public function render(): array { $table = $this->arguments['table']; $field = $this->arguments['field']; diff --git a/Classes/ViewHelpers/SubstrViewHelper.php b/Classes/ViewHelpers/SubstrViewHelper.php index 9537d698..f679d2c3 100644 --- a/Classes/ViewHelpers/SubstrViewHelper.php +++ b/Classes/ViewHelpers/SubstrViewHelper.php @@ -15,7 +15,7 @@ */ class SubstrViewHelper extends AbstractViewHelper { - public function initializeArguments() + public function initializeArguments(): void { $this->registerArgument('string', 'string', 'String to search in', true); $this->registerArgument('search', 'string', 'String to search', true); @@ -24,10 +24,10 @@ public function initializeArguments() } /** - * @return string the rendered string + * @return bool the rendered string * @author Benjamin Butschell */ - public function render() + public function render(): bool { $string = $this->arguments['string']; $search = $this->arguments['search']; diff --git a/Classes/ViewHelpers/TcaViewHelper.php b/Classes/ViewHelpers/TcaViewHelper.php index 54c8db8c..a9c091cb 100644 --- a/Classes/ViewHelpers/TcaViewHelper.php +++ b/Classes/ViewHelpers/TcaViewHelper.php @@ -22,7 +22,7 @@ class TcaViewHelper extends AbstractViewHelper /** * FieldHelper * - * @var \MASK\Mask\Helper\FieldHelper + * @var FieldHelper */ protected $fieldHelper; @@ -84,10 +84,10 @@ class TcaViewHelper extends AbstractViewHelper */ public function __construct(FieldHelper $fieldHelper = null) { - $this->fieldHelper = $fieldHelper ?? GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); + $this->fieldHelper = $fieldHelper ?? GeneralUtility::makeInstance(FieldHelper::class); } - public function initializeArguments() + public function initializeArguments(): void { parent::initializeArguments(); $this->registerArgument('type', 'string', 'Field type', true); @@ -101,7 +101,7 @@ public function initializeArguments() * @author Gernot Ploiner * @author Benjamin Butschell */ - public function render() + public function render(): array { $table = $this->arguments['table']; $type = $this->arguments['type']; diff --git a/Classes/ViewHelpers/TranslateLabelViewHelper.php b/Classes/ViewHelpers/TranslateLabelViewHelper.php index 491682fa..94b20a9f 100644 --- a/Classes/ViewHelpers/TranslateLabelViewHelper.php +++ b/Classes/ViewHelpers/TranslateLabelViewHelper.php @@ -21,7 +21,7 @@ */ class TranslateLabelViewHelper extends AbstractViewHelper { - public function initializeArguments() + public function initializeArguments(): void { $this->registerArgument('key', 'string', '', true); $this->registerArgument('extensionName', 'string', ''); @@ -31,8 +31,9 @@ public function initializeArguments() * The given key will be translated. If the result is empty, the key will be returned. * * @return string + * @noinspection PhpUndefinedMethodInspection */ - public function render() + public function render(): string { $key = $this->arguments['key']; $extensionName = $this->arguments['extensionName']; @@ -42,7 +43,7 @@ public function render() } $request = $this->renderingContext->getControllerContext()->getRequest(); - $extensionName = $extensionName === null ? $request->getControllerExtensionName() : $extensionName; + $extensionName = $extensionName ?? $request->getControllerExtensionName(); $result = LocalizationUtility::translate($key, $extensionName); return (empty($result) ? $key : $result); } diff --git a/Configuration/TCA/Overrides/pages.php b/Configuration/TCA/Overrides/pages.php index 93f2238b..c8f1d70a 100644 --- a/Configuration/TCA/Overrides/pages.php +++ b/Configuration/TCA/Overrides/pages.php @@ -1,12 +1,12 @@ load(); if (!empty($configuration) && array_key_exists('pages', $configuration)) { - $tcaCodeGenerator = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\CodeGenerator\\TcaCodeGenerator'); + $tcaCodeGenerator = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\CodeGenerator\TcaCodeGenerator::class); // Generate TCA for Pages $pagesColumns = $tcaCodeGenerator->generateFieldsTca($configuration['pages']['tca']); diff --git a/Configuration/TCA/Overrides/tt_content.php b/Configuration/TCA/Overrides/tt_content.php index 6f98efb3..038f0d81 100644 --- a/Configuration/TCA/Overrides/tt_content.php +++ b/Configuration/TCA/Overrides/tt_content.php @@ -11,12 +11,12 @@ $GLOBALS['TCA']['tt_content']['columns']['colPos']['config']['itemsProcFunc'] = 'MASK\Mask\ItemsProcFuncs\ColPosList->itemsProcFunc'; $GLOBALS['TCA']['tt_content']['columns']['CType']['config']['itemsProcFunc'] = 'MASK\Mask\ItemsProcFuncs\CTypeList->itemsProcFunc'; -$storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Domain\\Repository\\StorageRepository'); +$storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\Domain\Repository\StorageRepository::class); $configuration = $storageRepository->load(); if (!empty($configuration) && array_key_exists('tt_content', $configuration)) { - $tcaCodeGenerator = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\CodeGenerator\\TcaCodeGenerator'); + $tcaCodeGenerator = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\CodeGenerator\TcaCodeGenerator::class); // Generate TCA for Content-Elements $contentColumns = $tcaCodeGenerator->generateFieldsTca($configuration['tt_content']['tca']); @@ -26,7 +26,7 @@ if (!empty($configuration)) { - $tcaCodeGenerator = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\CodeGenerator\\TcaCodeGenerator'); + $tcaCodeGenerator = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\CodeGenerator\TcaCodeGenerator::class); // Generate TCA for Inline-Fields $tcaCodeGenerator->setInlineTca($configuration); } diff --git a/composer.json b/composer.json index 64f22d85..b3fb52ad 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,8 @@ "typo3/cms-core": "^10.3", "typo3/cms-backend": "^10.3", "typo3/cms-fluid": "^10.3", - "typo3/cms-extbase": "^10.3" + "typo3/cms-extbase": "^10.3", + "ext-json": "*" }, "replace": { "mask": "self.version", diff --git a/ext_localconf.php b/ext_localconf.php index 39ed0ab9..4549589d 100755 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -4,16 +4,16 @@ } // initialize mask utility for various things -$objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager'); -$storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Domain\\Repository\\StorageRepository'); -$fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper'); -$typoScriptCodeGenerator = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\CodeGenerator\\TyposcriptCodeGenerator'); -$settingsService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Domain\\Service\\SettingsService'); +$objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class); +$storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\Domain\Repository\StorageRepository::class); +$fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\Helper\FieldHelper::class); +$typoScriptCodeGenerator = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\CodeGenerator\TyposcriptCodeGenerator::class); +$settingsService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\Domain\Service\SettingsService::class); $configuration = $storageRepository->load(); $settings = $settingsService->get(); // Register Icons needed in the backend module -$iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance("TYPO3\CMS\Core\Imaging\IconRegistry"); +$iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class); $maskIcons = array( 'Check', 'Date', @@ -33,7 +33,7 @@ ); foreach ($maskIcons as $maskIcon) { $iconRegistry->registerIcon( - 'mask-fieldtype-' . $maskIcon, 'TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider', array( + 'mask-fieldtype-' . $maskIcon, TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, array( 'source' => 'EXT:mask/Resources/Public/Icons/Fieldtypes/' . $maskIcon . '.svg' ) ); @@ -88,21 +88,19 @@ function user_mask_beLayout($layout = null) $backend_layout_next_level = $data['backend_layout_next_level']; if ($backend_layout !== '') { // If backend_layout is set on current page - if (in_array($backend_layout, - [$layout, 'pagets__' . $layout])) { // Check backend_layout of current page + if (in_array($backend_layout, [$layout, 'pagets__' . $layout], true)) { // Check backend_layout of current page return true; } else { return false; } } elseif ($backend_layout_next_level !== '') { // If backend_layout_next_level is set on current page - if (in_array($backend_layout_next_level, - [$layout, 'pagets__' . $layout])) { // Check backend_layout_next_level of current page + if (in_array($backend_layout_next_level, [$layout, 'pagets__' . $layout], true)) { // Check backend_layout_next_level of current page return true; } else { return false; } } else { // If backend_layout and backend_layout_next_level is not set on current page, check backend_layout_next_level on rootline - $sysPage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository'); + $sysPage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\Page\PageRepository::class); try { $rootline = (\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Utility\RootlineUtility::class, $uid))->get(); @@ -110,7 +108,7 @@ function user_mask_beLayout($layout = null) $rootline = []; } foreach ($rootline as $page) { - if (in_array($page['backend_layout_next_level'], [$layout, 'pagets__' . $layout])) { + if (in_array($page['backend_layout_next_level'], [$layout, 'pagets__' . $layout], true)) { return true; } } @@ -136,16 +134,20 @@ function user_mask_beLayout($layout = null) } // SQL inject: -$signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\SignalSlot\\Dispatcher'); -$signalSlotDispatcher->connect('TYPO3\\CMS\\Install\\Service\\SqlExpectedSchemaService', 'tablesDefinitionIsBeingBuilt', - 'MASK\\Mask\\CodeGenerator\\SqlCodeGenerator', 'addDatabaseTablesDefinition'); +$signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class); +$signalSlotDispatcher->connect( + \TYPO3\CMS\Install\Service\SqlExpectedSchemaService::class, + 'tablesDefinitionIsBeingBuilt', + \MASK\Mask\CodeGenerator\SqlCodeGenerator::class, + 'addDatabaseTablesDefinition' +); // Enhance Fluid Output with overridden FluidTemplateContentObject -$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects']['TYPO3\\CMS\\Frontend\\ContentObject\\FluidTemplateContentObject'] = array( - 'className' => 'MASK\\Mask\\Fluid\\FluidTemplateContentObject' +$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][\TYPO3\CMS\Frontend\ContentObject\FluidTemplateContentObject::class] = array( + 'className' => \MASK\Mask\Fluid\FluidTemplateContentObject::class ); // Hook to override tt_content backend_preview $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem']['mask'] = \MASK\Mask\Hooks\PageLayoutViewDrawItem::class; // Hook to override colpos check for unused tt_content elements -$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['record_is_used'] [] = MASK\Mask\Hooks\PageLayoutViewHook::class . '->contentIsUsed'; +$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['record_is_used'] [] = \MASK\Mask\Hooks\PageLayoutViewHook::class . '->contentIsUsed'; diff --git a/ext_tables.php b/ext_tables.php index 8acb500f..cbac0e65 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -29,11 +29,11 @@ $TBE_STYLES['skins']['mask']['stylesheetDirectories'][] = 'EXT:mask/Resources/Public/Styles/Backend/'; //$TBE_STYLES['skins']['mask']['stylesheetDirectories'][] = "/" . $settings["backend"]; -$storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Domain\\Repository\\StorageRepository'); +$storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\Domain\Repository\StorageRepository::class); $configuration = $storageRepository->load(); if (!empty($configuration)) { - $tcaCodeGenerator = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\CodeGenerator\\TcaCodeGenerator'); + $tcaCodeGenerator = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\MASK\Mask\CodeGenerator\TcaCodeGenerator::class); // allow all inline tables on standard pages $tcaCodeGenerator->allowInlineTablesOnStandardPages($configuration); From f5d64df238b3f74e58009ec97dcc12337154ce5d Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Thu, 12 Mar 2020 19:14:58 +0100 Subject: [PATCH 37/93] [BUGFIX] prevent null pointer exception in explode --- Classes/Helper/FieldHelper.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Classes/Helper/FieldHelper.php b/Classes/Helper/FieldHelper.php index 1466556f..725b227a 100644 --- a/Classes/Helper/FieldHelper.php +++ b/Classes/Helper/FieldHelper.php @@ -149,7 +149,11 @@ public function getFormType($fieldKey, $elementKey = '', $type = 'tt_content'): } $tcaType = $tca['config']['type']; - $evals = explode(',', $tca['config']['eval']); + $evals = []; + if (isset($tca['config']['eval'])) { + $evals = explode(',', $tca['config']['eval']); + } + if ($tca['options'] === 'file') { $formType = 'File'; From f12dada4d5a9281482127ee11097991c1802d633 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Thu, 12 Mar 2020 19:20:43 +0100 Subject: [PATCH 38/93] [MERGE] merged redesign branch --- .../Backend/Partials/General/Controls.html | 17 +- .../Backend/Templates/Wizard/List.html | 224 ++++++++++++++++++ .../Backend/Templates/WizardContent/Edit.html | 6 +- .../Backend/Templates/WizardContent/List.html | 25 +- .../Backend/Templates/WizardContent/New.html | 4 +- .../Backend/Templates/WizardPage/Edit.html | 4 +- Resources/Private/Language/de.locallang.xlf | 10 +- Resources/Private/Language/locallang.xlf | 6 +- Resources/Public/Styles/styles.css | 100 +++++++- ext_tables.php | 5 +- 10 files changed, 353 insertions(+), 48 deletions(-) create mode 100644 Resources/Private/Backend/Templates/Wizard/List.html diff --git a/Resources/Private/Backend/Partials/General/Controls.html b/Resources/Private/Backend/Partials/General/Controls.html index 9c73a802..debaf7a1 100644 --- a/Resources/Private/Backend/Partials/General/Controls.html +++ b/Resources/Private/Backend/Partials/General/Controls.html @@ -1,19 +1,4 @@ - - - + class="btn btn-success col-sm-12" /> diff --git a/Resources/Private/Backend/Templates/Wizard/List.html b/Resources/Private/Backend/Templates/Wizard/List.html new file mode 100644 index 00000000..0e97f134 --- /dev/null +++ b/Resources/Private/Backend/Templates/Wizard/List.html @@ -0,0 +1,224 @@ +{namespace mask=MASK\Mask\ViewHelpers} +{namespace core = TYPO3\CMS\Core\ViewHelpers} + + +

    + + Mask + + + +

    + + + + + + + {message}
    +
    +
    + + + +
    + + +
    + +
    +
    +

    + + + erstellen +

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + +  
    + + + + +

    + + {storage.label} + +
    {key} +

    +
    +

    {storage.description}

    + + + + + + +
    + + +
    + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + Neues Inhaltselement anlegen + +
    +
    + +
    +

    + + + erweitern +

    + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    + + + + + +  
    + + + + + + + + + + + + + + +

    + +
    {layout.identifier} +

    +
    +

    {layout.description}

    +
    + + + + + + +
    +
    +
    +
    +
    +
    + developed by
    + + + +
    +
    +
    + +
    +
    + + +
    diff --git a/Resources/Private/Backend/Templates/WizardContent/Edit.html b/Resources/Private/Backend/Templates/WizardContent/Edit.html index 3d6b7585..c57c7a7c 100644 --- a/Resources/Private/Backend/Templates/WizardContent/Edit.html +++ b/Resources/Private/Backend/Templates/WizardContent/Edit.html @@ -8,12 +8,12 @@
    -

    {storage.label}

    +

    {storage.label} {storage.key}

    -
    +
    @@ -21,7 +21,7 @@

    {storage.label}

    -
    +
    • + +
      + + {message} +
      +
      @@ -51,13 +57,13 @@ - +

      - + {storage.label}
      {key} @@ -68,9 +74,8 @@

      {storage.description}

      - - - + + @@ -79,27 +84,27 @@
      - - + - + - + - +
      diff --git a/Resources/Private/Backend/Templates/WizardContent/New.html b/Resources/Private/Backend/Templates/WizardContent/New.html index 07816355..bbc07c1e 100644 --- a/Resources/Private/Backend/Templates/WizardContent/New.html +++ b/Resources/Private/Backend/Templates/WizardContent/New.html @@ -15,7 +15,7 @@

      -
      +
      @@ -24,7 +24,7 @@

      -
      +
        diff --git a/Resources/Private/Backend/Templates/WizardPage/Edit.html b/Resources/Private/Backend/Templates/WizardPage/Edit.html index 971ccbe3..45e0ee71 100644 --- a/Resources/Private/Backend/Templates/WizardPage/Edit.html +++ b/Resources/Private/Backend/Templates/WizardPage/Edit.html @@ -15,7 +15,7 @@

        -
        +
        @@ -24,7 +24,7 @@

        -
        +
        • Titel - Fehler! + Fehlende Verzeichnisse! Bild - Titel/Key + Titel / Key Beschreibung @@ -540,7 +540,7 @@ Bild - Titel/Uid + Titel / Uid Beschreibung @@ -554,7 +554,7 @@ - Achtung! + Kein Backendlayout gefunden Backend-Layout wurde aktualisert. @@ -586,7 +586,7 @@ Inhaltselemente - Seitenvorlagen + Backendlayouts diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf index 77d68fd1..97047bc3 100644 --- a/Resources/Private/Language/locallang.xlf +++ b/Resources/Private/Language/locallang.xlf @@ -451,7 +451,7 @@ Title - Error! + Missing folders! Image @@ -541,10 +541,10 @@ Extend Backend-Layout - No Backend-Layout found. Create at least one Backend-Layout in module "List". + Create at least one Backendlayout in module "List". - Caution! + No Backendlayout found Backend-Layout was updated. diff --git a/Resources/Public/Styles/styles.css b/Resources/Public/Styles/styles.css index c47d95cd..8c5727ba 100644 --- a/Resources/Public/Styles/styles.css +++ b/Resources/Public/Styles/styles.css @@ -39,7 +39,7 @@ Mask .id_Inline .tx_mask_btn_caption { padding-left: 5px; - border-left: 2px solid #ddd; + border-left: 2px solid #9c97ce; background-color: #ededed; } @@ -99,6 +99,7 @@ Mask .tx_mask_tabcell2 UL .dragtarget li.tx_mask_btn { margin-top: 3px; margin-bottom: 0px; + border-bottom: 2px solid #fafafa; } .tx_mask_tabcell2 UL.tx_mask_fieldtypes LI .id_typetext, @@ -149,19 +150,20 @@ Mask /* Texts */ UL.tx_mask_fieldtypes LI .id_typetext { - font-size: 120%; + /*font-size: 120%;*/ line-height: 220%; } UL.tx_mask_fieldtypes LI .id_labeltext { display: block; - font-size: 12px; + font-size: 13px; font-weight: bold; color: #525252; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; max-width: 220px; + font-family: 'Source Sans-Pro', sans-serif; } UL.tx_mask_fieldtypes LI .id_keytext { @@ -215,13 +217,18 @@ UL.tx_mask_fieldtypes .tx_mask_fieldcontent_highlight { } .tx_mask_tabcell1 LI { - font-family: Share, Verdana, Arial, Helvetica, sans-serif; - font-size: 1.1em; + font-family: 'Source Sans Pro',sans-serif; + font-size: 1.2em; + background: #6f6f6f; + box-shadow: none; + color: #4c4c4c; + font-weight: bold; } .tx_mask_tabcell1 LI .tx_mask_btn_actions { cursor: hand; cursor: pointer; + display: none; } .row.bench { @@ -703,6 +710,89 @@ UL.tx_mask_fieldtypes .tx_mask_fieldcontent_highlight { font-family: FontAwesome !important; } +.tx_mask_tabcell1 .id_String { + background: #51b3ad; +} +.tx_mask_tabcell1 .id_Integer { + background: #f98e71; +} +.tx_mask_tabcell1 .id_Float { + background: #f4a863; +} +.tx_mask_tabcell1 .id_Link { + background: #7fbacd; +} +.tx_mask_tabcell1 .id_Date { + background: #e17764; +} +.tx_mask_tabcell1 .id_Datetime { + background: #de87b5; +} +.tx_mask_tabcell1 .id_Text { + background: #6599bc; +} +.tx_mask_tabcell1 .id_Richtext { + background: #6eb47c; +} +.tx_mask_tabcell1 .id_Check { + background: #a4ce8d; +} +.tx_mask_tabcell1 .id_Radio { + background: #f8d760; +} +.tx_mask_tabcell1 .id_Select { + background: #b9cc70; +} +.tx_mask_tabcell1 .id_File { + background: #8db3f4; +} +.tx_mask_tabcell1 .id_Inline { + background: #9c97ce; +} +.tx_mask_tabcell1 .id_Content { + background: #95a9af; +} +.tx_mask_tabcell1 .id_Tab { + background: #837e76; +} +.tx_mask_tabcell1 .tx_mask_btn_row .tx_mask_btn_text { + background: #ffffffba; +} + +#typo3-inner-docbody { + max-width: 1500px; +} + +thead th { + height: 42px; +} + +table .btn-add { + margin: 8px auto; + display: block; + width: 270px; +} + +h1 .icon.t3js-icon { + margin-right: 10px; +} + +.imprint { + text-align: right; + margin-top: 70px; + letter-spacing: 2px; + font-size: 11px; + font-family: 'Source Sans Pro', sans-serif; + line-height: 11px; + color: #797979; + filter: saturate(0); +} + +img.brand-logo { + width: 100px; +} + + .mask_issues_container { float: right !important; } diff --git a/ext_tables.php b/ext_tables.php index cbac0e65..df8eadc3 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -13,8 +13,9 @@ 'mask', // Submodule key 'top', // Position array( - 'WizardContent' => 'list, new, create, edit, update, delete, purge, generate, showHtml, createMissingFolders, hide, activate, createHtml', - 'WizardPage' => 'list, new, create, edit, update, delete, showHtml', + 'Wizard' => 'list', + 'WizardContent' => 'new, create, edit, update, delete, purge, generate, showHtml, createMissingFolders, hide, activate, createHtml', + 'WizardPage' => 'new, create, edit, update, delete, showHtml', ), array( 'access' => 'admin', 'icon' => 'EXT:mask/Resources/Public/Icons/module-mask_wizard.svg', From 33d5a6c9e5b04178f60bca94aaf84494768618a6 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Thu, 12 Mar 2020 19:24:07 +0100 Subject: [PATCH 39/93] [BUGFIX] replaced PATH_site constant with Environment::getPublicPath() --- Classes/Imaging/IconProvider/ContentElementIconProvider.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Classes/Imaging/IconProvider/ContentElementIconProvider.php b/Classes/Imaging/IconProvider/ContentElementIconProvider.php index 0af7131b..739fd8d4 100644 --- a/Classes/Imaging/IconProvider/ContentElementIconProvider.php +++ b/Classes/Imaging/IconProvider/ContentElementIconProvider.php @@ -8,6 +8,7 @@ use MASK\Mask\Domain\Service\SettingsService; use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationExtensionNotConfiguredException; use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationPathDoesNotExistException; +use TYPO3\CMS\Core\Core\Environment; use TYPO3\CMS\Core\Imaging\Icon; use TYPO3\CMS\Core\Imaging\IconProviderInterface; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -130,7 +131,7 @@ protected function generateMarkup(Icon $icon, array $options): string } } else { if ($previewIconAvailable) { - $markup = 'getPreviewIconPath($options['contentElementKey']), '/')) . '" alt="' . $this->contentElement['label'] . '" title="' . $this->contentElement['label'] . '"/>'; } else { $color = $this->getColor($this->contentElement); @@ -154,7 +155,7 @@ protected function generateMarkup(Icon $icon, array $options): string */ protected function isPreviewIconAvailable($key): bool { - if (file_exists(PATH_site . $this->getPreviewIconPath($key))) { + if (file_exists(Environment::getPublicPath() . $this->getPreviewIconPath($key))) { return true; } return false; From 3ac2dd71a92e79ce2d71ad8d8302d875a172a7ab Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Thu, 12 Mar 2020 19:27:27 +0100 Subject: [PATCH 40/93] [BUGFIX] replace .txt fileendings with .typoscript --- Configuration/TypoScript/{page.txt => page.typoscript} | 0 Configuration/TypoScript/{setup.txt => setup.typoscript} | 0 ext_localconf.php | 2 +- ext_typoscript_setup.txt => ext_typoscript_setup.typoscript | 0 4 files changed, 1 insertion(+), 1 deletion(-) rename Configuration/TypoScript/{page.txt => page.typoscript} (100%) rename Configuration/TypoScript/{setup.txt => setup.typoscript} (100%) rename ext_typoscript_setup.txt => ext_typoscript_setup.typoscript (100%) diff --git a/Configuration/TypoScript/page.txt b/Configuration/TypoScript/page.typoscript similarity index 100% rename from Configuration/TypoScript/page.txt rename to Configuration/TypoScript/page.typoscript diff --git a/Configuration/TypoScript/setup.txt b/Configuration/TypoScript/setup.typoscript similarity index 100% rename from Configuration/TypoScript/setup.txt rename to Configuration/TypoScript/setup.typoscript diff --git a/ext_localconf.php b/ext_localconf.php index 4549589d..b2d63d27 100755 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -40,7 +40,7 @@ } // Add all the typoscript we need in the correct files -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(''); +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(''); $tsConfig = $typoScriptCodeGenerator->generateTsConfig($configuration); $pageTs = $typoScriptCodeGenerator->generatePageTyposcript($configuration); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig($tsConfig); diff --git a/ext_typoscript_setup.txt b/ext_typoscript_setup.typoscript similarity index 100% rename from ext_typoscript_setup.txt rename to ext_typoscript_setup.typoscript From de51ee963049109a71a90941134bb73c561c6ada Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Fri, 13 Mar 2020 13:28:28 +0100 Subject: [PATCH 41/93] [CLEANUP] replace double quotes with single quotes --- Classes/CodeGenerator/TyposcriptCodeGenerator.php | 8 ++++---- Classes/Domain/Repository/BackendLayoutRepository.php | 4 ++-- Classes/Domain/Repository/StorageRepository.php | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Classes/CodeGenerator/TyposcriptCodeGenerator.php b/Classes/CodeGenerator/TyposcriptCodeGenerator.php index 08d94088..a06b5ab9 100644 --- a/Classes/CodeGenerator/TyposcriptCodeGenerator.php +++ b/Classes/CodeGenerator/TyposcriptCodeGenerator.php @@ -86,10 +86,10 @@ public function generateTsConfig($json): string $content .= "}\n"; // and switch the labels depending on which content element is selected - $content .= "\n[maskContentType(\"CType|mask_" . $element["key"] . "\")]\n"; - if ($element["columns"]) { - foreach ($element["columns"] as $index => $column) { - $content .= " TCEFORM.tt_content." . $column . ".label = " . $element["labels"][$index] . "\n"; + $content .= "\n[maskContentType(\"CType|mask_" . $element['key'] . "\")]\n"; + if ($element['columns']) { + foreach ($element['columns'] as $index => $column) { + $content .= ' TCEFORM.tt_content.' . $column . '.label = ' . $element['labels'][$index] . "\n"; } } $content .= "[end]\n\n"; diff --git a/Classes/Domain/Repository/BackendLayoutRepository.php b/Classes/Domain/Repository/BackendLayoutRepository.php index b8be821d..1d82dad5 100644 --- a/Classes/Domain/Repository/BackendLayoutRepository.php +++ b/Classes/Domain/Repository/BackendLayoutRepository.php @@ -141,8 +141,8 @@ public function findIdentifierByPid($pid): bool $rootline = []; } foreach ($rootline as $page) { - if ($page["backend_layout_next_level"] !== "") { - return $page["backend_layout_next_level"]; + if ($page['backend_layout_next_level'] !== '') { + return $page['backend_layout_next_level']; } } return null; diff --git a/Classes/Domain/Repository/StorageRepository.php b/Classes/Domain/Repository/StorageRepository.php index f0b849d4..41384c3e 100644 --- a/Classes/Domain/Repository/StorageRepository.php +++ b/Classes/Domain/Repository/StorageRepository.php @@ -405,12 +405,12 @@ private function removeField($table, $field, $json, $remainingFields = array()): } if ($found) { // was not really deleted => can be deleted temporarly because it will be readded - $json = $this->removeField($inlineField["inlineParent"], "tx_mask_" . $inlineField["key"], + $json = $this->removeField($inlineField['inlineParent'], 'tx_mask_' . $inlineField['key'], $json); } else { // was really deleted and can only be deleted if father is not in use in another element if (($fatherGetsDeleted && count($elementsInUse) == 0) || !$fatherGetsDeleted) { - $json = $this->removeField($inlineField["inlineParent"], "tx_mask_" . $inlineField["key"], + $json = $this->removeField($inlineField['inlineParent'], 'tx_mask_' . $inlineField['key'], $json); } } From 143c810468a0355de7f3bb2b935a50d3d6b5e6c2 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Fri, 13 Mar 2020 13:33:07 +0100 Subject: [PATCH 42/93] [BUGFIX] loop variables fixed --- Classes/CodeGenerator/SqlCodeGenerator.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Classes/CodeGenerator/SqlCodeGenerator.php b/Classes/CodeGenerator/SqlCodeGenerator.php index f94d47e1..67cd7a07 100644 --- a/Classes/CodeGenerator/SqlCodeGenerator.php +++ b/Classes/CodeGenerator/SqlCodeGenerator.php @@ -179,13 +179,12 @@ public function getSqlByConfiguration($json): array if ($field) { foreach ($field as $table => $fields) { if ($fields) { - foreach ($fields as $field => $definition) { - $sql_content[] = 'CREATE TABLE ' . $table . " (\n\t" . $field . ' ' . $definition . "\n);\n"; - + foreach ($fields as $fieldKey => $definition) { + $sql_content[] = 'CREATE TABLE ' . $table . " (\n\t" . $fieldKey . ' ' . $definition . "\n);\n"; // if this field is a content field, also add parent columns - $fieldType = $fieldHelper->getFormType($field, '', $table); + $fieldType = $fieldHelper->getFormType($fieldKey, '', $table); if ($fieldType === 'Content') { - $sql_content[] = "CREATE TABLE tt_content (\n\t" . $field . '_parent' . ' ' . $definition . ",\n\t" . 'KEY ' . $field . ' (' . $field . '_parent,pid,deleted)' . "\n);\n"; + $sql_content[] = "CREATE TABLE tt_content (\n\t" . $fieldKey . '_parent' . ' ' . $definition . ",\n\t" . 'KEY ' . $fieldKey . ' (' . $fieldKey . '_parent,pid,deleted)' . "\n);\n"; } } } From 4baf6d48f6a95c324fe6465c23db1753b85602f0 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Fri, 13 Mar 2020 13:35:27 +0100 Subject: [PATCH 43/93] [CLEANUP] add missing @throws tags --- Classes/CodeGenerator/TcaCodeGenerator.php | 1 + Classes/Controller/WizardContentController.php | 2 ++ Classes/Controller/WizardPageController.php | 6 ++++++ 3 files changed, 9 insertions(+) diff --git a/Classes/CodeGenerator/TcaCodeGenerator.php b/Classes/CodeGenerator/TcaCodeGenerator.php index 6ca3477d..2294e420 100644 --- a/Classes/CodeGenerator/TcaCodeGenerator.php +++ b/Classes/CodeGenerator/TcaCodeGenerator.php @@ -44,6 +44,7 @@ class TcaCodeGenerator extends AbstractCodeGenerator /** * Generates and sets the correct tca for all the inline fields * @param array $json + * @throws Exception * @author Benjamin Butschell * @noinspection PhpUnused */ diff --git a/Classes/Controller/WizardContentController.php b/Classes/Controller/WizardContentController.php index 3e4f790d..f87f0967 100755 --- a/Classes/Controller/WizardContentController.php +++ b/Classes/Controller/WizardContentController.php @@ -88,6 +88,7 @@ public function newAction(): void * * @param array $storage * @return void + * @throws StopActionException */ public function createAction($storage): void { @@ -121,6 +122,7 @@ public function editAction($type, $key): void * * @param array $storage * @return void + * @throws StopActionException */ public function updateAction($storage): void { diff --git a/Classes/Controller/WizardPageController.php b/Classes/Controller/WizardPageController.php index 0d6abf57..4db29563 100755 --- a/Classes/Controller/WizardPageController.php +++ b/Classes/Controller/WizardPageController.php @@ -54,6 +54,8 @@ class WizardPageController extends WizardController * action list * * @return void + * @throws \TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationExtensionNotConfiguredException + * @throws \TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationPathDoesNotExistException * @noinspection PhpUnused */ public function listAction(): void @@ -67,6 +69,8 @@ public function listAction(): void * action new * * @return void + * @throws \TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationExtensionNotConfiguredException + * @throws \TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationPathDoesNotExistException * @noinspection PhpUnused */ public function newAction(): void @@ -97,6 +101,8 @@ public function createAction($storage): void * * @param string $layoutIdentifier * @return void + * @throws \TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationExtensionNotConfiguredException + * @throws \TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationPathDoesNotExistException * @noinspection PhpUnused */ public function editAction($layoutIdentifier = null): void From ed384fe52d331ada86446fdecb7cc15124baa2da Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Fri, 13 Mar 2020 13:41:25 +0100 Subject: [PATCH 44/93] [CLEANUP] uses and typecomparisons --- .../Repository/BackendLayoutRepository.php | 7 +-- .../MaskFunctionsProvider.php | 59 ++++++++++++------- 2 files changed, 41 insertions(+), 25 deletions(-) diff --git a/Classes/Domain/Repository/BackendLayoutRepository.php b/Classes/Domain/Repository/BackendLayoutRepository.php index 1d82dad5..d9157e03 100644 --- a/Classes/Domain/Repository/BackendLayoutRepository.php +++ b/Classes/Domain/Repository/BackendLayoutRepository.php @@ -36,9 +36,9 @@ use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Core\Utility\RootlineUtility; use TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings; use TYPO3\CMS\Extbase\Persistence\Repository; -use TYPO3\CMS\Frontend\Page\PageRepository; /** * Repository for \TYPO3\CMS\Extbase\Domain\Model\BackendLayout. @@ -133,11 +133,10 @@ public function findIdentifierByPid($pid): bool if ($backend_layout_next_level !== '') { // If backend_layout_next_level is set on current page return $backend_layout_next_level; } - $rootLineUtility = GeneralUtility::makeInstance(RootlineUtility::class, $pid); // , $MP, $this->context); - $sysPage = GeneralUtility::makeInstance(PageRepository::class); + $rootLineUtility = GeneralUtility::makeInstance(RootlineUtility::class, $pid); try { $rootline = $rootLineUtility->get(); - } catch (\RuntimeException $ex) { + } catch (RuntimeException $ex) { $rootline = []; } foreach ($rootline as $page) { diff --git a/Classes/ExpressionLanguage/MaskFunctionsProvider.php b/Classes/ExpressionLanguage/MaskFunctionsProvider.php index 60d9c109..aac90a3b 100644 --- a/Classes/ExpressionLanguage/MaskFunctionsProvider.php +++ b/Classes/ExpressionLanguage/MaskFunctionsProvider.php @@ -2,12 +2,21 @@ namespace MASK\Mask\ExpressionLanguage; +use Doctrine\DBAL\FetchMode; use Symfony\Component\ExpressionLanguage\ExpressionFunction; use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface; +use TYPO3\CMS\Core\Database\Connection; +use TYPO3\CMS\Core\Database\ConnectionPool; +use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction; +use TYPO3\CMS\Core\Domain\Repository\PageRepository; +use TYPO3\CMS\Core\Utility\GeneralUtility; class MaskFunctionsProvider implements ExpressionFunctionProviderInterface { - public function getFunctions() + /** + * @return array + */ + public function getFunctions(): array { return [ $this->maskBeLayout(), @@ -17,9 +26,10 @@ public function getFunctions() protected function maskBeLayout(): ExpressionFunction { - return new ExpressionFunction('maskBeLayout', function ($param) { + return new ExpressionFunction('maskBeLayout', static function ($param) { // Not implemented, we only use the evaluator - }, function ($arguments, $param = null) { + }, static function ($arguments, $param = null) { + $uid = null; $layout = $param; // get current page uid: if (is_array($_REQUEST['data']['pages'])) { // after saving page @@ -39,35 +49,41 @@ protected function maskBeLayout(): ExpressionFunction } if ($uid) { - /** @var \TYPO3\CMS\Core\Database\Connection $connection */ - $connection = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\ConnectionPool::class)->getConnectionForTable('pages'); + /** @var Connection $connection */ + $connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable('pages'); $query = $connection->createQueryBuilder(); - /** @var \TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction $deletedRestriction */ - $deletedRestriction = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction::class); + /** @var DeletedRestriction $deletedRestriction */ + $deletedRestriction = GeneralUtility::makeInstance(DeletedRestriction::class); $query->getRestrictions()->removeAll()->add($deletedRestriction); - $data = $query->select('backend_layout', 'backend_layout_next_level')->from('pages')->where($query->expr()->eq('uid', $uid))->execute() - ->fetch(\Doctrine\DBAL\FetchMode::ASSOCIATIVE); + $data = $query->select( + 'backend_layout', + 'backend_layout_next_level' + )->from('pages') + ->where( + $query->expr()->eq('uid', $uid) + )->execute() + ->fetch(FetchMode::ASSOCIATIVE); $backend_layout = $data['backend_layout']; $backend_layout_next_level = $data['backend_layout_next_level']; if ($backend_layout !== '') { // If backend_layout is set on current page - return in_array($backend_layout, [$layout, 'pagets__' . $layout]); + return in_array($backend_layout, [$layout, 'pagets__' . $layout], true); } if ($backend_layout_next_level !== '') { // If backend_layout_next_level is set on current page - return in_array($backend_layout_next_level, [$layout, 'pagets__' . $layout]); + return in_array($backend_layout_next_level, [$layout, 'pagets__' . $layout], true); } // If backend_layout and backend_layout_next_level is not set on current page, check backend_layout_next_level on rootline - $sysPage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Domain\Repository\PageRepository::class); + $sysPage = GeneralUtility::makeInstance(PageRepository::class); try { $rootline = $sysPage->getRootLine($uid, ''); } catch (\Exception $e) { $rootline = []; } foreach ($rootline as $page) { - if (in_array($page['backend_layout_next_level'], [$layout, 'pagets__' . $layout])) { + if (in_array($page['backend_layout_next_level'], [$layout, 'pagets__' . $layout], true)) { return true; } } @@ -78,9 +94,9 @@ protected function maskBeLayout(): ExpressionFunction protected function maskContentType(): ExpressionFunction { - return new ExpressionFunction('maskContentType', function ($param) { + return new ExpressionFunction('maskContentType', static function ($param) { // Not implemented, we only use the evaluator - }, function ($arguments, $param) { + }, static function ($arguments, $param) { static $cTypeCache = []; if (isset($_REQUEST['edit']['tt_content']) && is_array($_REQUEST['edit']['tt_content'])) { $field = explode('|', $param); @@ -94,15 +110,16 @@ protected function maskContentType(): ExpressionFunction $uid = (int)key($_REQUEST['edit']['tt_content']); if (!isset($cTypeCache[$uid])) { - /** @var \TYPO3\CMS\Core\Database\ConnectionPool $connection */ - $connection = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\ConnectionPool::class); + /** @var ConnectionPool $connection */ + $connection = GeneralUtility::makeInstance(ConnectionPool::class); $queryBuilder = $connection->getQueryBuilderForTable('tt_content'); - /** @var \TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction $deletedRestriction */ - $deletedRestriction = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction::class); + /** @var DeletedRestriction $deletedRestriction */ + $deletedRestriction = GeneralUtility::makeInstance(DeletedRestriction::class); $queryBuilder->getRestrictions()->removeAll()->add($deletedRestriction); - $cTypeCache[$uid] = $queryBuilder->select($field[0])->from('tt_content')->where($queryBuilder->expr()->eq('uid', $uid))->execute()->fetchColumn(0); + $cTypeCache[$uid] = $queryBuilder->select($field[0])->from('tt_content')->where($queryBuilder->expr()->eq('uid', + $uid))->execute()->fetchColumn(0); } - return $cTypeCache[$uid] == $field[1]; + return (string)$cTypeCache[$uid] === (string)$field[1]; } // if content element is loaded by ajax, then it's ok return is_array($_REQUEST['ajax']); From 61853d61dbf64feac93056542ed2a1a32e22f2ad Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Fri, 13 Mar 2020 14:00:52 +0100 Subject: [PATCH 45/93] [CLEANUP] convert to short array syntax --- Classes/CodeGenerator/SqlCodeGenerator.php | 6 +- Classes/CodeGenerator/TcaCodeGenerator.php | 190 +++++++------- .../CodeGenerator/TyposcriptCodeGenerator.php | 6 +- Classes/Controller/WizardController.php | 2 +- .../Repository/BackendLayoutRepository.php | 6 +- Classes/Domain/Repository/IconRepository.php | 4 +- .../Domain/Repository/StorageRepository.php | 14 +- Classes/Domain/Service/SettingsService.php | 2 +- .../MaskFunctionsProvider.php | 2 +- Classes/Fluid/FluidTemplateContentObject.php | 2 +- Classes/Helper/FieldHelper.php | 8 +- Classes/Helper/InlineHelper.php | 4 +- Classes/Hooks/PageLayoutViewDrawItem.php | 4 +- .../ContentElementIconProvider.php | 2 +- Classes/ItemsProcFuncs/ColPosList.php | 8 +- Classes/Utility/GeneralUtility.php | 2 +- Classes/ViewHelpers/CTypesViewHelper.php | 2 +- Classes/ViewHelpers/ContentViewHelper.php | 4 +- Configuration/TypoScript/setup.typoscript | 234 +++++++++--------- ext_localconf.php | 10 +- 20 files changed, 257 insertions(+), 255 deletions(-) diff --git a/Classes/CodeGenerator/SqlCodeGenerator.php b/Classes/CodeGenerator/SqlCodeGenerator.php index 67cd7a07..01f84ba6 100644 --- a/Classes/CodeGenerator/SqlCodeGenerator.php +++ b/Classes/CodeGenerator/SqlCodeGenerator.php @@ -123,9 +123,9 @@ public function updateDatabase(): array */ public function getSqlByConfiguration($json): array { - $sql_content = array(); + $sql_content = []; $types = array_keys($json); - $nonIrreTables = array('pages', 'tt_content'); + $nonIrreTables = ['pages', 'tt_content']; $fieldHelper = GeneralUtility::makeInstance(FieldHelper::class); // Generate SQL-Statements @@ -211,6 +211,6 @@ public function addDatabaseTablesDefinition(array $sqlString): array $json = $storageRepository->load(); $sql = $this->getSqlByConfiguration($json); $mergedSqlString = array_merge($sqlString, $sql); - return array('sqlString' => $mergedSqlString); + return ['sqlString' => $mergedSqlString]; } } diff --git a/Classes/CodeGenerator/TcaCodeGenerator.php b/Classes/CodeGenerator/TcaCodeGenerator.php index 2294e420..872a085e 100644 --- a/Classes/CodeGenerator/TcaCodeGenerator.php +++ b/Classes/CodeGenerator/TcaCodeGenerator.php @@ -51,7 +51,7 @@ class TcaCodeGenerator extends AbstractCodeGenerator public function setInlineTca($json): void { // Generate TCA for IRRE Fields and Tables - $notIrreTables = array('pages', 'tt_content', 'sys_file_reference'); + $notIrreTables = ['pages', 'tt_content', 'sys_file_reference']; if ($json) { foreach ($json as $table => $subJson) { if (!in_array($table, $notIrreTables, true)) { @@ -112,15 +112,15 @@ public function setElementsTca($tca): void if (!$elementvalue['hidden']) { $prependTabs = '--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general,'; - $fieldArray = array(); + $fieldArray = []; $label = $elementvalue['shortLabel'] ?: $elementvalue['label']; // Optional shortLabel // add new entry in CType selectbox - ExtensionManagementUtility::addPlugin(array( + ExtensionManagementUtility::addPlugin([ $label, 'mask_' . $elementvalue['key'], 'mask-ce-' . $elementvalue['key'] - ), 'CType', 'mask'); + ], 'CType', 'mask'); // add all the fields that should be shown if (is_array($elementvalue['columns'])) { @@ -206,7 +206,7 @@ public function setPageTca($tca): void public function generateFieldsTca($tca): array { $generalUtility = GeneralUtility::makeInstance(\MASK\Mask\Utility\GeneralUtility::class); - $columns = array(); + $columns = []; if ($tca) { foreach ($tca as $tcakey => $tcavalue) { $addToTca = true; @@ -215,30 +215,30 @@ public function generateFieldsTca($tca): array // Add File-Config for file-field if ($fieldkey === 'options' && $fieldvalue === 'file') { $fieldName = $tcakey; - $customSettingOverride = array( - 'overrideChildTca' => array( - 'types' => array( - '0' => array( + $customSettingOverride = [ + 'overrideChildTca' => [ + 'types' => [ + '0' => [ 'showitem' => '--palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette', - ), - '1' => array( + ], + '1' => [ 'showitem' => '--palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette', - ), - '2' => array( + ], + '2' => [ 'showitem' => '--palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette', - ), - '3' => array( + ], + '3' => [ 'showitem' => '--palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette', - ), - '4' => array( + ], + '4' => [ 'showitem' => '--palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette', - ), - '5' => array( + ], + '5' => [ 'showitem' => '--palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette', - ), - ), - ) - ); + ], + ], + ] + ]; $customSettingOverride['appearance'] = $tcavalue['config']['appearance']; if ($customSettingOverride['appearance']['fileUploadAllowed'] === '') { @@ -300,7 +300,7 @@ public function generateFieldsTca($tca): array // merge user inputs with file array if (!is_array($columns[$tcakey])) { - $columns[$tcakey] = array(); + $columns[$tcakey] = []; } else { ArrayUtility::mergeRecursiveWithOverrule($columns[$tcakey], $tcavalue); } @@ -344,8 +344,8 @@ public function generateFieldsTca($tca): array public function generateTableTca($table, $tca): void { - $tcaTemplate = array( - 'ctrl' => array( + $tcaTemplate = [ + 'ctrl' => [ 'title' => 'IRRE-Table', 'label' => 'uid', 'tstamp' => 'tstamp', @@ -357,133 +357,133 @@ public function generateTableTca($table, $tca): void 'transOrigPointerField' => 'l10n_parent', 'transOrigDiffSourceField' => 'l10n_diffsource', 'delete' => 'deleted', - 'enablecolumns' => array( + 'enablecolumns' => [ 'disabled' => 'hidden', 'starttime' => 'starttime', 'endtime' => 'endtime', - ), + ], 'searchFields' => '', 'dynamicConfigFile' => '', 'iconfile' => '' - ), - 'interface' => array( + ], + 'interface' => [ 'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, ', - ), - 'types' => array( - '1' => array('showitem' => 'sys_language_uid;;;;1-1-1, l10n_parent, l10n_diffsource, hidden;;1, --div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access, starttime, endtime'), - ), - 'palettes' => array( - '1' => array('showitem' => ''), - ), - 'columns' => array( - 'sys_language_uid' => array( + ], + 'types' => [ + '1' => ['showitem' => 'sys_language_uid;;;;1-1-1, l10n_parent, l10n_diffsource, hidden;;1, --div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access, starttime, endtime'], + ], + 'palettes' => [ + '1' => ['showitem' => ''], + ], + 'columns' => [ + 'sys_language_uid' => [ 'exclude' => 1, 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.language', - 'config' => array( + 'config' => [ 'type' => 'select', 'renderType' => 'selectSingle', - 'items' => array( - array( + 'items' => [ + [ 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.allLanguages', -1, 'flags-multiple' - ), - ), + ], + ], 'special' => 'languages', 'default' => 0 - ), - ), - 'l10n_parent' => array( + ], + ], + 'l10n_parent' => [ 'displayCond' => 'FIELD:sys_language_uid:>:0', 'exclude' => 1, 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent', - 'config' => array( + 'config' => [ 'type' => 'select', 'renderType' => 'selectSingle', - 'items' => array( - array('', 0), - ), + 'items' => [ + ['', 0], + ], 'foreign_table' => 'tx_test_domain_model_murph', 'foreign_table_where' => 'AND tx_test_domain_model_murph.pid=###CURRENT_PID### AND tx_test_domain_model_murph.sys_language_uid IN (-1,0)', 'default' => 0, - ), - ), - 'l10n_diffsource' => array( - 'config' => array( + ], + ], + 'l10n_diffsource' => [ + 'config' => [ 'type' => 'passthrough', - ), - ), - 't3ver_label' => array( + ], + ], + 't3ver_label' => [ 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.versionLabel', - 'config' => array( + 'config' => [ 'type' => 'input', 'size' => 30, 'max' => 255, - ) - ), - 'hidden' => array( + ] + ], + 'hidden' => [ 'exclude' => 1, 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.hidden', - 'config' => array( + 'config' => [ 'type' => 'check', - ), - ), - 'starttime' => array( + ], + ], + 'starttime' => [ 'exclude' => 1, 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.starttime', - 'config' => array( - 'behaviour' => array( + 'config' => [ + 'behaviour' => [ 'allowLanguageSynchronization' => true - ), + ], 'renderType' => 'inputDateTime', 'type' => 'input', 'size' => 13, 'eval' => 'datetime,int', 'checkbox' => 0, 'default' => 0 - ), - ), - 'endtime' => array( + ], + ], + 'endtime' => [ 'exclude' => 1, 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.endtime', - 'config' => array( - 'behaviour' => array( + 'config' => [ + 'behaviour' => [ 'allowLanguageSynchronization' => true - ), + ], 'renderType' => 'inputDateTime', 'type' => 'input', 'size' => 13, 'eval' => 'datetime,int', 'checkbox' => 0, 'default' => 0 - ), - ), - 'parentid' => array( - 'config' => array( + ], + ], + 'parentid' => [ + 'config' => [ 'type' => 'select', 'renderType' => 'selectSingle', - 'items' => array( - array('', 0), - ), + 'items' => [ + ['', 0], + ], 'foreign_table' => 'tt_content', 'foreign_table_where' => 'AND tt_content.pid=###CURRENT_PID### AND tt_content.sys_language_uid IN (-1,###REC_FIELD_sys_language_uid###)', 'default' => 0 - ), - ), - 'parenttable' => array( - 'config' => array( + ], + ], + 'parenttable' => [ + 'config' => [ 'type' => 'passthrough', - ), - ), - 'sorting' => array( - 'config' => array( + ], + ], + 'sorting' => [ + 'config' => [ 'type' => 'passthrough', - ), - ), - ), - ); + ], + ], + ], + ]; $fieldHelper = GeneralUtility::makeInstance(FieldHelper::class); $generalUtility = GeneralUtility::makeInstance(\MASK\Mask\Utility\GeneralUtility::class); @@ -556,7 +556,7 @@ public function generateTableTca($table, $tca): void */ public function allowInlineTablesOnStandardPages($configuration): void { - $notIrreTables = array('pages', 'tt_content', 'sys_file_reference'); + $notIrreTables = ['pages', 'tt_content', 'sys_file_reference']; if ($configuration) { foreach ($configuration as $table => $subJson) { if (!in_array($table, $notIrreTables, true)) { diff --git a/Classes/CodeGenerator/TyposcriptCodeGenerator.php b/Classes/CodeGenerator/TyposcriptCodeGenerator.php index a06b5ab9..55e5222b 100644 --- a/Classes/CodeGenerator/TyposcriptCodeGenerator.php +++ b/Classes/CodeGenerator/TyposcriptCodeGenerator.php @@ -60,9 +60,9 @@ public function generateTsConfig($json): string // Register icons for contentelements $iconIdentifier = 'mask-ce-' . $element['key']; $iconRegistry->registerIcon( - $iconIdentifier, ContentElementIconProvider::class, array( + $iconIdentifier, ContentElementIconProvider::class, [ 'contentElementKey' => $element['key'] - ) + ] ); if (!$element['hidden']) { @@ -106,7 +106,7 @@ public function generateTsConfig($json): string */ public function generatePageTyposcript($json): string { - $pageColumns = array(); + $pageColumns = []; $disableColumns = ''; $pagesContent = ''; if ($json['pages']['elements']) { diff --git a/Classes/Controller/WizardController.php b/Classes/Controller/WizardController.php index d0934aab..26c6eab5 100755 --- a/Classes/Controller/WizardController.php +++ b/Classes/Controller/WizardController.php @@ -272,7 +272,7 @@ protected function redirectByAction(): void { $params = $this->request->getArguments(); $formAction = $params['formAction']; - $arguments = array(); + $arguments = []; if ($params['storage']['type'] === 'pages') { $arguments['layoutIdentifier'] = $this->backendLayoutRepository->findByIdentifier( $params['storage']['elements']['key'], diff --git a/Classes/Domain/Repository/BackendLayoutRepository.php b/Classes/Domain/Repository/BackendLayoutRepository.php index d9157e03..371af92b 100644 --- a/Classes/Domain/Repository/BackendLayoutRepository.php +++ b/Classes/Domain/Repository/BackendLayoutRepository.php @@ -71,9 +71,9 @@ public function initializeObject(): void * @param array $pageTsPids * @return array */ - public function findAll($pageTsPids = array()): array + public function findAll($pageTsPids = []): array { - $backendLayouts = array(); + $backendLayouts = []; // search all the pids for backend layouts defined in the pageTS foreach ($pageTsPids as $pid) { @@ -155,7 +155,7 @@ public function findIdentifierByPid($pid): bool * @param array $pageTsPids * @return BackendLayout|null */ - public function findByIdentifier($identifier, $pageTsPids = array()): ?BackendLayout + public function findByIdentifier($identifier, $pageTsPids = []): ?BackendLayout { $backendLayouts = $this->findAll($pageTsPids); return $backendLayouts[$identifier] ?? null; diff --git a/Classes/Domain/Repository/IconRepository.php b/Classes/Domain/Repository/IconRepository.php index 23846f3e..72cf4cf7 100644 --- a/Classes/Domain/Repository/IconRepository.php +++ b/Classes/Domain/Repository/IconRepository.php @@ -42,7 +42,7 @@ class IconRepository */ public function findAll(): array { - $icons = array( + $icons = [ 'fa-500px', 'fa-address-book', 'fa-address-book-o', @@ -829,7 +829,7 @@ public function findAll(): array 'fa-youtube', 'fa-youtube-play', 'fa-youtube-square' - ); + ]; $preparedIcons = []; foreach ($icons as $icon) { $preparedIcons[$icon] = $icon; diff --git a/Classes/Domain/Repository/StorageRepository.php b/Classes/Domain/Repository/StorageRepository.php index 41384c3e..ed68270e 100644 --- a/Classes/Domain/Repository/StorageRepository.php +++ b/Classes/Domain/Repository/StorageRepository.php @@ -89,7 +89,7 @@ public function __construct() public function load(): array { if (self::$json === null) { - self::$json = array(); + self::$json = []; if (!empty($this->extSettings['json'])) { $file = MaskUtility::getFileAbsFileName($this->extSettings['json']); if (file_exists($file)) { @@ -142,7 +142,7 @@ public function loadField($type, $key): array public function loadInlineFields($parentKey): array { $json = $this->load(); - $inlineFields = array(); + $inlineFields = []; foreach ($json as $table) { if ($table['tca']) { foreach ($table['tca'] as $key => $tca) { @@ -169,7 +169,7 @@ public function loadInlineFields($parentKey): array public function loadElement($type, $key): array { $json = $this->load(); - $fields = array(); + $fields = []; $columns = $json[$type]['elements'][$key]['columns']; //Check if it is an array before trying to count it @@ -226,7 +226,7 @@ public function add($content): void $json[$content['type']]['elements'][$content['elements']['key']][$key] = $value; } - $columns = array(); + $columns = []; // delete columns and labels of irre-fields from elements if ($content['elements']['columns']) { @@ -301,7 +301,7 @@ public function add($content): void * @param string $key * @param array $remainingFields */ - public function remove($type, $key, $remainingFields = array()): void + public function remove($type, $key, $remainingFields = []): void { // Load $json = $this->load(); @@ -358,12 +358,12 @@ public function activate($type, $key): void * @author Benjamin Butschell * */ - private function removeField($table, $field, $json, $remainingFields = array()): array + private function removeField($table, $field, $json, $remainingFields = []): array { $this->fieldHelper = GeneralUtility::makeInstance(FieldHelper::class); // check if this field is used in any other elements - $elementsInUse = array(); + $elementsInUse = []; if ($json[$table]['elements']) { foreach ($json[$table]['elements'] as $element) { if ($element['columns']) { diff --git a/Classes/Domain/Service/SettingsService.php b/Classes/Domain/Service/SettingsService.php index 16588590..77a17486 100644 --- a/Classes/Domain/Service/SettingsService.php +++ b/Classes/Domain/Service/SettingsService.php @@ -46,7 +46,7 @@ class SettingsService * @var array * @api */ - protected $settings = array(); + protected $settings = []; /** * Contains the settings of the $_EXTCONF diff --git a/Classes/ExpressionLanguage/MaskFunctionsProvider.php b/Classes/ExpressionLanguage/MaskFunctionsProvider.php index aac90a3b..94b38320 100644 --- a/Classes/ExpressionLanguage/MaskFunctionsProvider.php +++ b/Classes/ExpressionLanguage/MaskFunctionsProvider.php @@ -40,7 +40,7 @@ protected function maskBeLayout(): ExpressionFunction if ($GLOBALS['_SERVER']['HTTP_REFERER'] !== '') { $url = $GLOBALS['_SERVER']['HTTP_REFERER']; $queryString = parse_url($url, PHP_URL_QUERY); - $result = array(); + $result = []; parse_str($queryString, $result); if ($result['id']) { $uid = (int)$result['id']; diff --git a/Classes/Fluid/FluidTemplateContentObject.php b/Classes/Fluid/FluidTemplateContentObject.php index 70bcff01..72cffba4 100755 --- a/Classes/Fluid/FluidTemplateContentObject.php +++ b/Classes/Fluid/FluidTemplateContentObject.php @@ -64,7 +64,7 @@ class FluidTemplateContentObject extends \TYPO3\CMS\Frontend\ContentObject\Fluid * @throws Exception * @author Benjamin Butschell */ - protected function getContentObjectVariables(array $conf = array()): array + protected function getContentObjectVariables(array $conf = []): array { // Call Parent Function to maintain core functions $variables = parent::getContentObjectVariables($conf); diff --git a/Classes/Helper/FieldHelper.php b/Classes/Helper/FieldHelper.php index 725b227a..de6eb51c 100644 --- a/Classes/Helper/FieldHelper.php +++ b/Classes/Helper/FieldHelper.php @@ -69,7 +69,7 @@ public function getElementsWhichUseField($key, $type = 'tt_content'): array { $storage = $this->storageRepository->load(); - $elementsInUse = array(); + $elementsInUse = []; if ($storage[$type]['elements']) { foreach ($storage[$type]['elements'] as $element) { if ($element['columns']) { @@ -141,7 +141,7 @@ public function getFormType($fieldKey, $elementKey = '', $type = 'tt_content'): } // if field is in inline table or $GLOBALS["TCA"] is not yet filled, load tca from json - if ($tca === null || !in_array($type, array('tt_content', 'pages'))) { + if ($tca === null || !in_array($type, ['tt_content', 'pages'])) { $tca = $this->storageRepository->loadField($type, $fieldKey); if (!$tca['config']) { $tca = $this->storageRepository->loadField($type, 'tx_mask_' . $fieldKey); @@ -186,7 +186,7 @@ public function getFormType($fieldKey, $elementKey = '', $type = 'tt_content'): break; case 'text': $formType = 'Text'; - if (in_array($type, array('tt_content', 'pages'))) { + if (in_array($type, ['tt_content', 'pages'])) { if ($elementKey) { $fieldNumberKey = -1; if (is_array($element['columns'])) { @@ -267,7 +267,7 @@ public function getFieldType($fieldKey, $elementKey = '', $excludeInlineFields = if ($storage && !$excludeInlineFields) { $types = array_keys($storage); } else { - $types = array(); + $types = []; } $types[] = 'pages'; $types[] = 'tt_content'; diff --git a/Classes/Helper/InlineHelper.php b/Classes/Helper/InlineHelper.php index 5f407ed4..07e5d987 100644 --- a/Classes/Helper/InlineHelper.php +++ b/Classes/Helper/InlineHelper.php @@ -109,7 +109,7 @@ public function addFilesToData(&$data, $table = 'tt_content'): void $storage = $this->storageRepository->load(); $fileRepository = $this->objectManager->get(FileRepository::class); - $contentFields = array('media', 'image', 'assets'); + $contentFields = ['media', 'image', 'assets']; if ($storage[$table]['tca']) { foreach ($storage[$table]['tca'] as $fieldKey => $field) { $contentFields[] = $fieldKey; @@ -261,7 +261,7 @@ public function getInlineElements( $rows = $queryBuilder->execute()->fetchAll(); // and recursively add them to an array - $elements = array(); + $elements = []; foreach ($rows as $element) { if (TYPO3_MODE === 'FE') { $GLOBALS['TSFE']->sys_page->versionOL($childTable, $element); diff --git a/Classes/Hooks/PageLayoutViewDrawItem.php b/Classes/Hooks/PageLayoutViewDrawItem.php index 64a056dd..27f38fdf 100644 --- a/Classes/Hooks/PageLayoutViewDrawItem.php +++ b/Classes/Hooks/PageLayoutViewDrawItem.php @@ -136,11 +136,11 @@ public function preProcess( // if there are paths for layouts and partials set, add them to view if (!empty($this->extSettings['layouts_backend'])) { $layoutRootPath = MaskUtility::getFileAbsFileName($this->extSettings['layouts_backend']); - $view->setLayoutRootPaths(array($layoutRootPath)); + $view->setLayoutRootPaths([$layoutRootPath]); } if (!empty($this->extSettings['partials_backend'])) { $partialRootPath = MaskUtility::getFileAbsFileName($this->extSettings['partials_backend']); - $view->setPartialRootPaths(array($partialRootPath)); + $view->setPartialRootPaths([$partialRootPath]); } // Fetch and assign some useful variables diff --git a/Classes/Imaging/IconProvider/ContentElementIconProvider.php b/Classes/Imaging/IconProvider/ContentElementIconProvider.php index 739fd8d4..0ffc1f8c 100644 --- a/Classes/Imaging/IconProvider/ContentElementIconProvider.php +++ b/Classes/Imaging/IconProvider/ContentElementIconProvider.php @@ -83,7 +83,7 @@ class ContentElementIconProvider implements IconProviderInterface * @throws Exception * @author Benjamin Butschell */ - public function prepareIconMarkup(Icon $icon, array $options = array()): void + public function prepareIconMarkup(Icon $icon, array $options = []): void { // error checking if (empty($options['contentElementKey'])) { diff --git a/Classes/ItemsProcFuncs/ColPosList.php b/Classes/ItemsProcFuncs/ColPosList.php index 07e8d1d6..9ee6366c 100644 --- a/Classes/ItemsProcFuncs/ColPosList.php +++ b/Classes/ItemsProcFuncs/ColPosList.php @@ -46,14 +46,14 @@ public function itemsProcFunc(&$params): void // if this tt_content element is inline element of mask if ((int)$params['row']['colPos'] === $this->colPos) { // only allow mask nested element column - $params['items'] = array( - array( + $params['items'] = [ + [ LocalizationUtility::translate('mask_content_colpos', 'mask'), $this->colPos, null, null - ) - ); + ] + ]; } else { // if it is not inline tt_content element // and if other itemsProcFunc from other extension was available (e.g. gridelements), diff --git a/Classes/Utility/GeneralUtility.php b/Classes/Utility/GeneralUtility.php index b94092c5..3c2a51cd 100755 --- a/Classes/Utility/GeneralUtility.php +++ b/Classes/Utility/GeneralUtility.php @@ -93,7 +93,7 @@ public function getRteTransformMode($fieldKey, $type = 'tt_content'): string { $storage = $this->storageRepository->load(); $transformMode = ''; - $matches = array(); + $matches = []; if (isset($storage[$type]['tca'][$fieldKey]['defaultExtras'])) { $re = "/(rte_transform\\[([a-z=_]+)\\])/"; preg_match($re, $storage[$type]['tca'][$fieldKey]['defaultExtras'], $matches); diff --git a/Classes/ViewHelpers/CTypesViewHelper.php b/Classes/ViewHelpers/CTypesViewHelper.php index f71bbdc7..105a58b5 100644 --- a/Classes/ViewHelpers/CTypesViewHelper.php +++ b/Classes/ViewHelpers/CTypesViewHelper.php @@ -28,7 +28,7 @@ class CTypesViewHelper extends AbstractViewHelper */ public function render(): array { - $items = array(); + $items = []; $cTypes = $GLOBALS['TCA']['tt_content']['columns']['CType']['config']['items']; if ($cTypes) { foreach ($cTypes as $type) { diff --git a/Classes/ViewHelpers/ContentViewHelper.php b/Classes/ViewHelpers/ContentViewHelper.php index 960bd6c6..c0632db2 100644 --- a/Classes/ViewHelpers/ContentViewHelper.php +++ b/Classes/ViewHelpers/ContentViewHelper.php @@ -40,11 +40,11 @@ public function initializeArguments(): void */ public function render(): string { - $conf = array( + $conf = [ 'tables' => 'tt_content', 'source' => $this->arguments['uid'], 'dontCheckPid' => 1 - ); + ]; return $this->cObj->cObjGetSingle('RECORDS', $conf); } diff --git a/Configuration/TypoScript/setup.typoscript b/Configuration/TypoScript/setup.typoscript index 6d92b296..4e9fbb85 100644 --- a/Configuration/TypoScript/setup.typoscript +++ b/Configuration/TypoScript/setup.typoscript @@ -1,33 +1,33 @@ plugin.tx_mask { - view { - templateRootPaths.0 = EXT:mask/Resources/Private/Templates/ - partialRootPaths.0 = EXT:mask/Resources/Private/Partials/ - layoutRootPaths.0 = EXT:mask/Resources/Private/Layouts/ - } + view { + templateRootPaths.0 = EXT:mask/Resources/Private/Templates/ + partialRootPaths.0 = EXT:mask/Resources/Private/Partials/ + layoutRootPaths.0 = EXT:mask/Resources/Private/Layouts/ + } } module.tx_mask { - view { - templateRootPaths.0 = EXT:mask/Resources/Private/Backend/Templates/ - partialRootPaths.0 = EXT:mask/Resources/Private/Backend/Partials/ - layoutRootPaths.0 = EXT:mask/Resources/Private/Backend/Layouts/ - } + view { + templateRootPaths.0 = EXT:mask/Resources/Private/Backend/Templates/ + partialRootPaths.0 = EXT:mask/Resources/Private/Backend/Partials/ + layoutRootPaths.0 = EXT:mask/Resources/Private/Backend/Layouts/ + } } # snippet to render content elements lib.tx_mask.content = RECORDS lib.tx_mask.content { - tables = tt_content - source.current = 1 - dontCheckPid = 1 + tables = tt_content + source.current = 1 + dontCheckPid = 1 } # mask content elements are rendered with this snippet lib.maskContentElement = FLUIDTEMPLATE lib.maskContentElement { - dataProcessing { - 100 = MASK\Mask\DataProcessing\MaskProcessor - } + dataProcessing { + 100 = MASK\Mask\DataProcessing\MaskProcessor + } } @@ -35,123 +35,123 @@ lib.maskContentElement { temp.mask.page = PAGE temp.mask.page { - 10 = FLUIDTEMPLATE - 10 { - file.stdWrap.cObject = CASE - file.stdWrap.cObject { - key.data = levelfield:-1, backend_layout_next_level, slide - key.override.field = backend_layout - - default = TEXT -# default.value = fileadmin/templates/default.html - default.value = typo3conf/ext/mask/Resources/Private/Backend/Layouts/Default.html - } - } + 10 = FLUIDTEMPLATE + 10 { + file.stdWrap.cObject = CASE + file.stdWrap.cObject { + key.data = levelfield:-1, backend_layout_next_level, slide + key.override.field = backend_layout - headerData.10 = CASE - headerData.10 { - key.data = levelfield:-1, backend_layout_next_level, slide - key.override.field = backend_layout + default = TEXT + # default.value = fileadmin/templates/default.html + default.value = typo3conf/ext/mask/Resources/Private/Backend/Layouts/Default.html } + } + + headerData.10 = CASE + headerData.10 { + key.data = levelfield:-1, backend_layout_next_level, slide + key.override.field = backend_layout + } } # Creates persistent ParseFunc setup for non-HTML content. This is recommended to use (as a reference!) lib.parseFunc { - makelinks = 1 - makelinks.http.keep = path - makelinks.http.extTarget < lib.parseTarget - makelinks.http.extTarget = - makelinks.http.extTarget.override = _blank - makelinks.mailto.keep = path - tags { - link = TEXT - link { - current = 1 - typolink.parameter.data = parameters : allParams - typolink.extTarget < lib.parseTarget - typolink.extTarget = - typolink.extTarget.override = _blank - typolink.target < lib.parseTarget - parseFunc.constants = 1 - } + makelinks = 1 + makelinks.http.keep = path + makelinks.http.extTarget < lib.parseTarget + makelinks.http.extTarget = + makelinks.http.extTarget.override = _blank + makelinks.mailto.keep = path + tags { + link = TEXT + link { + current = 1 + typolink.parameter.data = parameters : allParams + typolink.extTarget < lib.parseTarget + typolink.extTarget = + typolink.extTarget.override = _blank + typolink.target < lib.parseTarget + parseFunc.constants = 1 } + } - allowTags = a, abbr, acronym, address, article, aside, b, bdo, big, blockquote, br, caption, center, cite, code, col, colgroup, dd, del, dfn, dl, div, dt, em, font, footer, header, h1, h2, h3, h4, h5, h6, hr, i, img, ins, kbd, label, li, link, meta, nav, ol, p, pre, q, samp, sdfield, section, small, span, strike, strong, style, sub, sup, table, thead, tbody, tfoot, td, th, tr, title, tt, u, ul, var - denyTags = * - constants = 1 + allowTags = a, abbr, acronym, address, article, aside, b, bdo, big, blockquote, br, caption, center, cite, code, col, colgroup, dd, del, dfn, dl, div, dt, em, font, footer, header, h1, h2, h3, h4, h5, h6, hr, i, img, ins, kbd, label, li, link, meta, nav, ol, p, pre, q, samp, sdfield, section, small, span, strike, strong, style, sub, sup, table, thead, tbody, tfoot, td, th, tr, title, tt, u, ul, var + denyTags = * + constants = 1 - nonTypoTagStdWrap.HTMLparser = 1 - nonTypoTagStdWrap.HTMLparser { - keepNonMatchedTags = 1 - htmlSpecialChars = 2 - } + nonTypoTagStdWrap.HTMLparser = 1 + nonTypoTagStdWrap.HTMLparser { + keepNonMatchedTags = 1 + htmlSpecialChars = 2 + } } # Creates persistent ParseFunc setup for RTE content (which is mainly HTML) based on the "ts_css" transformation. lib.parseFunc_RTE < lib.parseFunc lib.parseFunc_RTE { - // makelinks > - # Processing and
          blocks separately - externalBlocks = article, aside, blockquote, div, dd, dl, footer, header, nav, ol, section, table, ul - externalBlocks { - # The blockquote content is passed into parseFunc again... - blockquote.stripNL = 1 - blockquote.callRecursive = 1 - blockquote.callRecursive.tagStdWrap.HTMLparser = 1 - blockquote.callRecursive.tagStdWrap.HTMLparser.tags.blockquote.overrideAttribs = style="margin-bottom:0;margin-top:0;" - - ol.stripNL = 1 - ol.stdWrap.parseFunc =< lib.parseFunc - - ul.stripNL = 1 - ul.stdWrap.parseFunc =< lib.parseFunc - - table.stripNL = 1 - table.stdWrap.HTMLparser = 1 - table.stdWrap.HTMLparser.tags.table.fixAttrib.class { - default = contenttable - always = 1 - list = contenttable - } - - table.stdWrap.HTMLparser.keepNonMatchedTags = 1 - table.HTMLtableCells = 1 - table.HTMLtableCells { - # Recursive call to self but without wrapping non-wrapped cell content - default.stdWrap { - parseFunc =< lib.parseFunc_RTE - parseFunc.nonTypoTagStdWrap.encapsLines.nonWrappedTag = - } - - addChr10BetweenParagraphs = 1 - } - - div.stripNL = 1 - div.callRecursive = 1 - - article < .div - aside < .div - footer < .div - header < .div - nav < .div - section < .div - - # Definition list processing - dl < .div - dd < .div + // makelinks > + # Processing
          and
          blocks separately + externalBlocks = article, aside, blockquote, div, dd, dl, footer, header, nav, ol, section, table, ul + externalBlocks { + # The blockquote content is passed into parseFunc again... + blockquote.stripNL = 1 + blockquote.callRecursive = 1 + blockquote.callRecursive.tagStdWrap.HTMLparser = 1 + blockquote.callRecursive.tagStdWrap.HTMLparser.tags.blockquote.overrideAttribs = style="margin-bottom:0;margin-top:0;" + + ol.stripNL = 1 + ol.stdWrap.parseFunc =< lib.parseFunc + + ul.stripNL = 1 + ul.stdWrap.parseFunc =< lib.parseFunc + + table.stripNL = 1 + table.stdWrap.HTMLparser = 1 + table.stdWrap.HTMLparser.tags.table.fixAttrib.class { + default = contenttable + always = 1 + list = contenttable } - nonTypoTagStdWrap.encapsLines { - encapsTagList = p,pre,h1,h2,h3,h4,h5,h6,hr,dt - remapTag.DIV = P - nonWrappedTag = P - innerStdWrap_all.ifBlank =   - addAttributes.P.class.setOnly = blank - } + table.stdWrap.HTMLparser.keepNonMatchedTags = 1 + table.HTMLtableCells = 1 + table.HTMLtableCells { + # Recursive call to self but without wrapping non-wrapped cell content + default.stdWrap { + parseFunc =< lib.parseFunc_RTE + parseFunc.nonTypoTagStdWrap.encapsLines.nonWrappedTag = + } - nonTypoTagStdWrap.HTMLparser = 1 - nonTypoTagStdWrap.HTMLparser { - keepNonMatchedTags = 1 - htmlSpecialChars = 2 + addChr10BetweenParagraphs = 1 } + + div.stripNL = 1 + div.callRecursive = 1 + + article < .div + aside < .div + footer < .div + header < .div + nav < .div + section < .div + + # Definition list processing + dl < .div + dd < .div + } + + nonTypoTagStdWrap.encapsLines { + encapsTagList = p,pre,h1,h2,h3,h4,h5,h6,hr,dt + remapTag.DIV = P + nonWrappedTag = P + innerStdWrap_all.ifBlank =   + addAttributes.P.class.setOnly = blank + } + + nonTypoTagStdWrap.HTMLparser = 1 + nonTypoTagStdWrap.HTMLparser { + keepNonMatchedTags = 1 + htmlSpecialChars = 2 + } } diff --git a/ext_localconf.php b/ext_localconf.php index 2d70d497..69325223 100755 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -32,9 +32,10 @@ 'Content' ]; foreach ($maskIcons as $maskIcon) { - $iconRegistry->registerIcon('mask-fieldtype-' . $maskIcon, TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, [ - 'source' => 'EXT:mask/Resources/Public/Icons/Fieldtypes/' . $maskIcon . '.svg' - ]); + $iconRegistry->registerIcon('mask-fieldtype-' . $maskIcon, + TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, [ + 'source' => 'EXT:mask/Resources/Public/Icons/Fieldtypes/' . $maskIcon . '.svg' + ]); } // Add all the typoscript we need in the correct files @@ -61,7 +62,8 @@ // SQL inject: $signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class); - $signalSlotDispatcher->connect(TYPO3\CMS\Install\Service\SqlExpectedSchemaService::class, 'tablesDefinitionIsBeingBuilt', MASK\Mask\CodeGenerator\SqlCodeGenerator::class, + $signalSlotDispatcher->connect(TYPO3\CMS\Install\Service\SqlExpectedSchemaService::class, + 'tablesDefinitionIsBeingBuilt', MASK\Mask\CodeGenerator\SqlCodeGenerator::class, 'addDatabaseTablesDefinition'); // Enhance Fluid Output with overridden FluidTemplateContentObject From 4696ced2c8c6e80de8bc89a555130ffa546b8e16 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Fri, 13 Mar 2020 14:16:25 +0100 Subject: [PATCH 46/93] [CLEANUP] remove unnecessary @author tags in methods --- Classes/CodeGenerator/HtmlCodeGenerator.php | 1 - Classes/CodeGenerator/SqlCodeGenerator.php | 1 - Classes/CodeGenerator/TcaCodeGenerator.php | 4 ---- Classes/Controller/WizardContentController.php | 1 - Classes/Controller/WizardController.php | 5 ----- Classes/Domain/Repository/StorageRepository.php | 4 ---- Classes/Fluid/FluidTemplateContentObject.php | 1 - Classes/Helper/FieldHelper.php | 4 ---- Classes/Helper/InlineHelper.php | 3 --- .../Imaging/IconProvider/ContentElementIconProvider.php | 7 ------- Classes/Utility/GeneralUtility.php | 4 ---- Classes/ViewHelpers/CTypesViewHelper.php | 1 - Classes/ViewHelpers/ElementCountViewHelper.php | 1 - Classes/ViewHelpers/SubstrViewHelper.php | 1 - Classes/ViewHelpers/TcaViewHelper.php | 1 - 15 files changed, 39 deletions(-) diff --git a/Classes/CodeGenerator/HtmlCodeGenerator.php b/Classes/CodeGenerator/HtmlCodeGenerator.php index 1b2f0d33..1378649d 100644 --- a/Classes/CodeGenerator/HtmlCodeGenerator.php +++ b/Classes/CodeGenerator/HtmlCodeGenerator.php @@ -64,7 +64,6 @@ public function generateHtml($key, $table): string * @param string $datafield * @return string $html * @author Gernot Ploiner - * @author Benjamin Butschell */ protected function generateFieldHtml($fieldKey, $elementKey, $table, $datafield = 'data'): string { diff --git a/Classes/CodeGenerator/SqlCodeGenerator.php b/Classes/CodeGenerator/SqlCodeGenerator.php index 01f84ba6..db1be408 100644 --- a/Classes/CodeGenerator/SqlCodeGenerator.php +++ b/Classes/CodeGenerator/SqlCodeGenerator.php @@ -103,7 +103,6 @@ protected function performDbUpdates(array $sqlStatements): array * @throws SchemaException * @throws StatementException * @throws UnexpectedSignalReturnValueTypeException - * @author Benjamin Butschell */ public function updateDatabase(): array { diff --git a/Classes/CodeGenerator/TcaCodeGenerator.php b/Classes/CodeGenerator/TcaCodeGenerator.php index 872a085e..cbc7a273 100644 --- a/Classes/CodeGenerator/TcaCodeGenerator.php +++ b/Classes/CodeGenerator/TcaCodeGenerator.php @@ -45,7 +45,6 @@ class TcaCodeGenerator extends AbstractCodeGenerator * Generates and sets the correct tca for all the inline fields * @param array $json * @throws Exception - * @author Benjamin Butschell * @noinspection PhpUnused */ public function setInlineTca($json): void @@ -86,7 +85,6 @@ public function setInlineTca($json): void * Generates and sets the tca for all the content-elements * * @param array $tca - * @author Benjamin Butschell * @noinspection PhpUnused */ public function setElementsTca($tca): void @@ -157,7 +155,6 @@ public function setElementsTca($tca): void * Generates and sets the tca for all the extended pages * * @param array $tca - * @author Benjamin Butschell */ public function setPageTca($tca): void { @@ -339,7 +336,6 @@ public function generateFieldsTca($tca): array * @param string $table * @param array $tca * @return void - * @author Benjamin Butschell */ public function generateTableTca($table, $tca): void { diff --git a/Classes/Controller/WizardContentController.php b/Classes/Controller/WizardContentController.php index f87f0967..60265431 100755 --- a/Classes/Controller/WizardContentController.php +++ b/Classes/Controller/WizardContentController.php @@ -201,7 +201,6 @@ public function activateAction($key): void * Deletes Fluid html, if file exists * * @param string $key - * @author Benjamin Butschell */ protected function deleteHtml($key): void { diff --git a/Classes/Controller/WizardController.php b/Classes/Controller/WizardController.php index 26c6eab5..4c659f0a 100755 --- a/Classes/Controller/WizardController.php +++ b/Classes/Controller/WizardController.php @@ -145,7 +145,6 @@ public function initializeAction(): void /** * Generates all the necessary files * @author Gernot Ploiner - * @author Benjamin Butschell * @todo clear typoscript cache after generating * @noinspection PhpUnhandledExceptionInspection */ @@ -163,7 +162,6 @@ public function generateAction(): void * Prepares the storage array for fluid view * * @param array $storage - * @author Benjamin Butschell */ protected function prepareStorage(&$storage): void { @@ -266,7 +264,6 @@ public function checkElementKey(ServerRequest $request, Response $response): Res /** * Redirects the request to the correct view * @throws StopActionException - * @author Benjamin Butschell */ protected function redirectByAction(): void { @@ -308,7 +305,6 @@ protected function checkFolders(): void /** * Creates missing folders that are needed for the use of mask * @return bool $success - * @author Benjamin Butschell */ protected function createMissingFolders(): bool { @@ -323,7 +319,6 @@ protected function createMissingFolders(): bool /** * action creates missing folders * @throws StopActionException - * @author Benjamin Butschell * @noinspection PhpUnused */ public function createMissingFoldersAction(): void diff --git a/Classes/Domain/Repository/StorageRepository.php b/Classes/Domain/Repository/StorageRepository.php index ed68270e..17019833 100644 --- a/Classes/Domain/Repository/StorageRepository.php +++ b/Classes/Domain/Repository/StorageRepository.php @@ -124,7 +124,6 @@ public function write($json): void * @param $type * @param $key * @return array - * @author Benjamin Butschell */ public function loadField($type, $key): array { @@ -137,7 +136,6 @@ public function loadField($type, $key): array * * @param string $parentKey key of the inline-field * @return array - * @author Benjamin Butschell */ public function loadInlineFields($parentKey): array { @@ -355,7 +353,6 @@ public function activate($type, $key): void * @param array $json * @param array $remainingFields * @return array - * @author Benjamin Butschell * */ private function removeField($table, $field, $json, $remainingFields = []): array @@ -437,7 +434,6 @@ private function removeField($table, $field, $json, $remainingFields = []): arra * @param string $table * @param array $json * @return array - * @author Benjamin Butschell */ private function cleanTable($table, $json): array { diff --git a/Classes/Fluid/FluidTemplateContentObject.php b/Classes/Fluid/FluidTemplateContentObject.php index 72cffba4..59db0b25 100755 --- a/Classes/Fluid/FluidTemplateContentObject.php +++ b/Classes/Fluid/FluidTemplateContentObject.php @@ -62,7 +62,6 @@ class FluidTemplateContentObject extends \TYPO3\CMS\Frontend\ContentObject\Fluid * @param array $conf Configuration * @return array * @throws Exception - * @author Benjamin Butschell */ protected function getContentObjectVariables(array $conf = []): array { diff --git a/Classes/Helper/FieldHelper.php b/Classes/Helper/FieldHelper.php index de6eb51c..d9148b85 100644 --- a/Classes/Helper/FieldHelper.php +++ b/Classes/Helper/FieldHelper.php @@ -63,7 +63,6 @@ public function __construct(StorageRepository $storageRepository = null) * @param string $key TCA Type * @param string $type elementtype * @return array elements in use - * @author Benjamin Butschell */ public function getElementsWhichUseField($key, $type = 'tt_content'): array { @@ -91,7 +90,6 @@ public function getElementsWhichUseField($key, $type = 'tt_content'): array * @param string $fieldKey Key if Field * @param string $type elementtype * @return string Label - * @author Benjamin Butschell */ public function getLabel($elementKey, $fieldKey, $type = 'tt_content'): string { @@ -119,7 +117,6 @@ public function getLabel($elementKey, $fieldKey, $type = 'tt_content'): string * @param string $elementKey Key of Element * @param string $type elementtype * @return string formType - * @author Benjamin Butschell */ public function getFormType($fieldKey, $elementKey = '', $type = 'tt_content'): string { @@ -257,7 +254,6 @@ public function getFormType($fieldKey, $elementKey = '', $type = 'tt_content'): * @param string $elementKey key of element * @param bool $excludeInlineFields * @return string $fieldType returns fieldType or null if not found - * @author Benjamin Butschell */ public function getFieldType($fieldKey, $elementKey = '', $excludeInlineFields = false): string { diff --git a/Classes/Helper/InlineHelper.php b/Classes/Helper/InlineHelper.php index 07e5d987..f52189ed 100644 --- a/Classes/Helper/InlineHelper.php +++ b/Classes/Helper/InlineHelper.php @@ -86,7 +86,6 @@ public function __construct(StorageRepository $storageRepository = null) * @param array $data * @param string $table * @throws Exception - * @author Benjamin Butschell */ public function addFilesToData(&$data, $table = 'tt_content'): void { @@ -131,7 +130,6 @@ public function addFilesToData(&$data, $table = 'tt_content'): void * @param string $table * @param string $cType * @throws \Exception - * @author Benjamin Butschell */ public function addIrreToData(&$data, $table = 'tt_content', $cType = ''): void { @@ -218,7 +216,6 @@ public function addIrreToData(&$data, $table = 'tt_content', $cType = ''): void * @return array all irre elements of this attribut * @throws Exception * @throws \Exception - * @author Benjamin Butschell */ public function getInlineElements( $data, diff --git a/Classes/Imaging/IconProvider/ContentElementIconProvider.php b/Classes/Imaging/IconProvider/ContentElementIconProvider.php index 0ffc1f8c..aff9a7aa 100644 --- a/Classes/Imaging/IconProvider/ContentElementIconProvider.php +++ b/Classes/Imaging/IconProvider/ContentElementIconProvider.php @@ -81,7 +81,6 @@ class ContentElementIconProvider implements IconProviderInterface * @throws ExtensionConfigurationExtensionNotConfiguredException * @throws ExtensionConfigurationPathDoesNotExistException * @throws Exception - * @author Benjamin Butschell */ public function prepareIconMarkup(Icon $icon, array $options = []): void { @@ -106,7 +105,6 @@ public function prepareIconMarkup(Icon $icon, array $options = []): void * @param array $options * @return string * @throws InvalidArgumentException - * @author Benjamin Butschell */ protected function generateMarkup(Icon $icon, array $options): string { @@ -151,7 +149,6 @@ protected function generateMarkup(Icon $icon, array $options): string * Checks if a preview icon is available in defined folder * @param string $key * @return boolean - * @author Benjamin Butschell */ protected function isPreviewIconAvailable($key): bool { @@ -166,7 +163,6 @@ protected function isPreviewIconAvailable($key): bool * @param array $element * @return boolean * @todo implement - * @author Benjamin Butschell */ protected function isFontAwesomeKeyAvailable($element): bool { @@ -176,7 +172,6 @@ protected function isFontAwesomeKeyAvailable($element): bool /** * @param string $key * @return string - * @author Benjamin Butschell */ protected function getPreviewIconPath($key): string { @@ -187,7 +182,6 @@ protected function getPreviewIconPath($key): string * returns trimmed and unified font-awesome key * @param array $element * @return string - * @author Benjamin Butschell */ protected function getFontAwesomeKey($element): string { @@ -198,7 +192,6 @@ protected function getFontAwesomeKey($element): string * returns trimmed and unified hex-code * @param array $element * @return string - * @author Benjamin Butschell */ protected function getColor($element): string { diff --git a/Classes/Utility/GeneralUtility.php b/Classes/Utility/GeneralUtility.php index 3c2a51cd..8077bfa7 100755 --- a/Classes/Utility/GeneralUtility.php +++ b/Classes/Utility/GeneralUtility.php @@ -65,7 +65,6 @@ public function __construct(StorageRepository $storageRepository = null) * @param string $evalValue value to search for * @param string $type elementtype * @return boolean $evalValue is set - * @author Benjamin Butschell */ public function isEvalValueSet($fieldKey, $evalValue, $type = 'tt_content'): bool { @@ -87,7 +86,6 @@ public function isEvalValueSet($fieldKey, $evalValue, $type = 'tt_content'): boo * @param string $fieldKey TCA Type * @param string $type elementtype * @return string $rte_transform - * @author Benjamin Butschell */ public function getRteTransformMode($fieldKey, $type = 'tt_content'): string { @@ -109,7 +107,6 @@ public function getRteTransformMode($fieldKey, $type = 'tt_content'): string * @param string $property value to search for * @param string $type elementtype * @return int|null $evalValue is set - * @author Benjamin Butschell */ public function getJsOpenParamValue($fieldKey, $property, $type = 'tt_content'): ?int { @@ -158,7 +155,6 @@ public function getJsOpenParamValue($fieldKey, $property, $type = 'tt_content'): * @param string $evalValue value to search for * @param string $type elementtype * @return boolean $evalValue is set - * @author Benjamin Butschell */ public function isBlindLinkOptionSet($fieldKey, $evalValue, $type = 'tt_content'): bool { diff --git a/Classes/ViewHelpers/CTypesViewHelper.php b/Classes/ViewHelpers/CTypesViewHelper.php index 105a58b5..c0efe94f 100644 --- a/Classes/ViewHelpers/CTypesViewHelper.php +++ b/Classes/ViewHelpers/CTypesViewHelper.php @@ -24,7 +24,6 @@ class CTypesViewHelper extends AbstractViewHelper * Returns an array with all content element cTypes * * @return array $items an array with all content element cTypes - * @author Benjamin Butschell */ public function render(): array { diff --git a/Classes/ViewHelpers/ElementCountViewHelper.php b/Classes/ViewHelpers/ElementCountViewHelper.php index 016c2c8e..83db321c 100644 --- a/Classes/ViewHelpers/ElementCountViewHelper.php +++ b/Classes/ViewHelpers/ElementCountViewHelper.php @@ -37,7 +37,6 @@ public function initializeArguments(): void * Counts the occurences in tt_content * * @return int number of uses of this content element - * @author Benjamin Butschell * @noinspection PhpUndefinedMethodInspection */ public function render(): int diff --git a/Classes/ViewHelpers/SubstrViewHelper.php b/Classes/ViewHelpers/SubstrViewHelper.php index f679d2c3..de757b0f 100644 --- a/Classes/ViewHelpers/SubstrViewHelper.php +++ b/Classes/ViewHelpers/SubstrViewHelper.php @@ -25,7 +25,6 @@ public function initializeArguments(): void /** * @return bool the rendered string - * @author Benjamin Butschell */ public function render(): bool { diff --git a/Classes/ViewHelpers/TcaViewHelper.php b/Classes/ViewHelpers/TcaViewHelper.php index a9c091cb..9daedcad 100644 --- a/Classes/ViewHelpers/TcaViewHelper.php +++ b/Classes/ViewHelpers/TcaViewHelper.php @@ -99,7 +99,6 @@ public function initializeArguments(): void * * @return array all TCA elements of this attribut * @author Gernot Ploiner - * @author Benjamin Butschell */ public function render(): array { From 455255ce6358efcc6cdf7e8c98f5725ad0d0dd0c Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Fri, 13 Mar 2020 14:30:42 +0100 Subject: [PATCH 47/93] [BUGFIX] mask condition providers fixed --- Classes/CodeGenerator/TyposcriptCodeGenerator.php | 2 +- Classes/ExpressionLanguage/MaskProvider.php | 9 ++------- Configuration/ExpressionLanguage.php | 5 +++-- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Classes/CodeGenerator/TyposcriptCodeGenerator.php b/Classes/CodeGenerator/TyposcriptCodeGenerator.php index 55e5222b..1291d9af 100644 --- a/Classes/CodeGenerator/TyposcriptCodeGenerator.php +++ b/Classes/CodeGenerator/TyposcriptCodeGenerator.php @@ -112,7 +112,7 @@ public function generatePageTyposcript($json): string if ($json['pages']['elements']) { foreach ($json['pages']['elements'] as $element) { // Labels for pages - $pagesContent .= "\n[userFunc = user_mask_beLayout(" . $element['key'] . ")]\n"; + $pagesContent .= "\n[userFunc = maskBeLayout(" . $element['key'] . ")]\n"; // if page has backendlayout with this element-key if ($element['columns']) { foreach ($element['columns'] as $index => $column) { diff --git a/Classes/ExpressionLanguage/MaskProvider.php b/Classes/ExpressionLanguage/MaskProvider.php index 315cc2fa..6ec0717e 100644 --- a/Classes/ExpressionLanguage/MaskProvider.php +++ b/Classes/ExpressionLanguage/MaskProvider.php @@ -2,20 +2,15 @@ namespace MASK\Mask\ExpressionLanguage; +use TYPO3\CMS\Core\ExpressionLanguage\AbstractProvider; use TYPO3\CMS\Core\ExpressionLanguage\FunctionsProvider\Typo3ConditionFunctionsProvider; -class MaskProvider extends \TYPO3\CMS\Core\ExpressionLanguage\AbstractProvider +class MaskProvider extends AbstractProvider { public function __construct() { - $this->expressionLanguageVariables = [ - // 'foo' => 1, - // 'bar' => 2, - ]; $this->expressionLanguageProviders = [ - // We use the existing Typo3ConditionsFunctions... Typo3ConditionFunctionsProvider::class, - // ... and our custom function provider MaskFunctionsProvider::class ]; } diff --git a/Configuration/ExpressionLanguage.php b/Configuration/ExpressionLanguage.php index fff0db86..a8512be1 100644 --- a/Configuration/ExpressionLanguage.php +++ b/Configuration/ExpressionLanguage.php @@ -1,12 +1,13 @@ [ - \MASK\Mask\ExpressionLanguage\MaskProvider::class, - \MASK\Mask\ExpressionLanguage\MaskContentTypeConditionProvider::class, + MaskProvider::class ] ]; From b50d69cb298d59a25917445f18684d74331fe730 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Fri, 13 Mar 2020 14:37:36 +0100 Subject: [PATCH 48/93] [CLEANUP] full qualified name for validators --- Classes/Domain/Model/BackendLayout.php | 4 ++-- Classes/Domain/Model/Page.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Classes/Domain/Model/BackendLayout.php b/Classes/Domain/Model/BackendLayout.php index a2855451..e9acce5a 100644 --- a/Classes/Domain/Model/BackendLayout.php +++ b/Classes/Domain/Model/BackendLayout.php @@ -43,13 +43,13 @@ class BackendLayout extends AbstractEntity /** * @var string - * @Validate("NotEmpty") + * @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty") */ protected $title = ''; /** * @var int - * @Validate("NotEmpty") + * @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty") */ protected $uid = ''; diff --git a/Classes/Domain/Model/Page.php b/Classes/Domain/Model/Page.php index 53ee4d5a..d8faf178 100644 --- a/Classes/Domain/Model/Page.php +++ b/Classes/Domain/Model/Page.php @@ -44,7 +44,7 @@ class Page extends AbstractEntity * Title of the Pagetemplate. * * @var string - * @Validate("NotEmpty") + * @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty") */ protected $title; @@ -59,7 +59,7 @@ class Page extends AbstractEntity * Lowercase internal Key. Not Visible in TYPO3 Backend. * * @var string - * @Validate("NotEmpty") + * @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty") */ protected $fieldkey; From f30b06d6207228915f17e0a3eaf7924ea40e2085 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Fri, 13 Mar 2020 14:42:19 +0100 Subject: [PATCH 49/93] [TASK] remove unneeded files --- ...kContentTypeConditionFunctionsProvider.php | 93 ------------------- .../MaskContentTypeConditionProvider.php | 25 ----- 2 files changed, 118 deletions(-) delete mode 100644 Classes/ExpressionLanguage/MaskContentTypeConditionFunctionsProvider.php delete mode 100644 Classes/ExpressionLanguage/MaskContentTypeConditionProvider.php diff --git a/Classes/ExpressionLanguage/MaskContentTypeConditionFunctionsProvider.php b/Classes/ExpressionLanguage/MaskContentTypeConditionFunctionsProvider.php deleted file mode 100644 index 942717b9..00000000 --- a/Classes/ExpressionLanguage/MaskContentTypeConditionFunctionsProvider.php +++ /dev/null @@ -1,93 +0,0 @@ - - */ -class MaskContentTypeConditionFunctionsProvider implements ExpressionFunctionProviderInterface -{ - /** - * @return ExpressionFunction[] - */ - public function getFunctions(): array - { - return [ - $this->getMaskContentElementFunction() - ]; - } - - /** - * @return ExpressionFunction - * @noinspection PhpComposerExtensionStubsInspection - */ - protected function getMaskContentElementFunction(): ExpressionFunction - { - $getContentElementType = static function (int $uid): string { - /** @var QueryBuilder $queryBuilder */ - $queryBuilder = GeneralUtility::makeInstance(ConnectionPoolAlias::class) - ->getQueryBuilderForTable('tt_content'); - /** @var DeletedRestriction $deletedRestriction */ - $deletedRestriction = GeneralUtility::makeInstance(DeletedRestrictionAlias::class); - $queryBuilder->getRestrictions() - ->removeAll() - ->add($deletedRestriction); - - return (string)$queryBuilder->select('CType') - ->from('tt_content') - ->where($queryBuilder->expr()->eq('uid', $uid)) - ->execute() - ->fetchColumn(); - }; - - return new ExpressionFunction('isMaskContentType', static function () { - // Not implemented, we only use the evaluator - }, static function ($arguments, $value) use ($getContentElementType) { - static $contentTypeMappingCache = []; - - /** @var RequestWrapper $request */ - $request = $arguments['request']; - $requestParameters = $request->getQueryParams(); - if (isset($requestParameters['edit']['tt_content']) && - is_array($requestParameters['edit']['tt_content']) - ) { - $formType = (string)current($requestParameters['edit']['tt_content']); - $contentType = null; - // New record, content type (CType) given as request parameter - if ($formType === 'new' && isset($requestParameters['defVals']['tt_content']['CType'])) { - $contentType = (string)$requestParameters['defVals']['tt_content']['CType']; - } else { - // Existing record, fetch content type (CType) from database - $uid = (int)key($requestParameters['edit']['tt_content']); - $contentType = $contentTypeMappingCache[$uid] ?? $getContentElementType($uid); - } - - return $contentType === 'mask_' . $value; - } - - // Content element is loaded via ajax (inline) - $parsedBody = $request->getParsedBody(); - if (isset($parsedBody['ajax']['context'])) { - $parsedContext = json_decode($parsedBody['ajax']['context'], true, 512, JSON_THROW_ON_ERROR); - if (isset($parsedContext['config']['overrideChildTca']['columns']['CType']['config']['default'])) { - return $parsedContext['config']['overrideChildTca']['columns']['CType']['config']['default'] === 'mask_' . $value; - } - } - - return false; - }); - } -} diff --git a/Classes/ExpressionLanguage/MaskContentTypeConditionProvider.php b/Classes/ExpressionLanguage/MaskContentTypeConditionProvider.php deleted file mode 100644 index 0022aaa7..00000000 --- a/Classes/ExpressionLanguage/MaskContentTypeConditionProvider.php +++ /dev/null @@ -1,25 +0,0 @@ - - */ -class MaskContentTypeConditionProvider extends AbstractProvider -{ - public function __construct() - { - $this->expressionLanguageVariables = [ - 'request' => GeneralUtility::makeInstance(RequestWrapper::class, $GLOBALS['TYPO3_REQUEST'] ?? null), - ]; - $this->expressionLanguageProviders[] = MaskContentTypeConditionFunctionsProvider::class; - } -} From 06f40ed7b6009a8e0f149990b621cb7b60e12c51 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Fri, 13 Mar 2020 14:46:31 +0100 Subject: [PATCH 50/93] [TASK] adjust default layout --- .../Private/Backend/Layouts/Default.html | 22 ++----------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/Resources/Private/Backend/Layouts/Default.html b/Resources/Private/Backend/Layouts/Default.html index 09c227fd..81c83a19 100644 --- a/Resources/Private/Backend/Layouts/Default.html +++ b/Resources/Private/Backend/Layouts/Default.html @@ -5,25 +5,7 @@ Modal:'TYPO3/CMS/Backend/Modal' }" includeJsFiles="{0: '{f:uri.resource(path:\'Scripts/libs.js\')}', 1: '{f:uri.resource(path:\'Scripts/scripts.js\')}'}" - > -
          -
          -
          -
          -
          -
          -
          -
          - -
          -
          -
          -
          -
          - - -
          -
          -
          + + From 30eff731f328d50b7b589346abf1ca555e2bc93e Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Fri, 13 Mar 2020 15:09:02 +0100 Subject: [PATCH 51/93] [BUGFIX] set correct return types --- Classes/Domain/Repository/BackendLayoutRepository.php | 2 +- Classes/Domain/Repository/StorageRepository.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Classes/Domain/Repository/BackendLayoutRepository.php b/Classes/Domain/Repository/BackendLayoutRepository.php index 371af92b..4096e131 100644 --- a/Classes/Domain/Repository/BackendLayoutRepository.php +++ b/Classes/Domain/Repository/BackendLayoutRepository.php @@ -108,7 +108,7 @@ public function findAll($pageTsPids = []): array * @return bool * @throws Exception */ - public function findIdentifierByPid($pid): bool + public function findIdentifierByPid($pid): ?string { /** @var Connection $connection */ $connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable('pages'); diff --git a/Classes/Domain/Repository/StorageRepository.php b/Classes/Domain/Repository/StorageRepository.php index 17019833..b6179c3d 100644 --- a/Classes/Domain/Repository/StorageRepository.php +++ b/Classes/Domain/Repository/StorageRepository.php @@ -125,7 +125,7 @@ public function write($json): void * @param $key * @return array */ - public function loadField($type, $key): array + public function loadField($type, $key): ?array { $json = $this->load(); return $json[$type]['tca'][$key]; @@ -164,7 +164,7 @@ public function loadInlineFields($parentKey): array * @param $key * @return array */ - public function loadElement($type, $key): array + public function loadElement($type, $key): ?array { $json = $this->load(); $fields = []; From e2911f145fd5075b4d0efe8195ed26b7af5f5635 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Mon, 16 Mar 2020 11:10:40 +0100 Subject: [PATCH 52/93] [BUGFIX] replace some string comparisons with empty() method --- Classes/CodeGenerator/TcaCodeGenerator.php | 8 ++++---- Classes/Domain/Repository/BackendLayoutRepository.php | 6 +++--- Classes/ExpressionLanguage/MaskFunctionsProvider.php | 6 +++--- Classes/Helper/InlineHelper.php | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Classes/CodeGenerator/TcaCodeGenerator.php b/Classes/CodeGenerator/TcaCodeGenerator.php index cbc7a273..4df43315 100644 --- a/Classes/CodeGenerator/TcaCodeGenerator.php +++ b/Classes/CodeGenerator/TcaCodeGenerator.php @@ -247,7 +247,7 @@ public function generateFieldsTca($tca): array $customSettingOverride['appearance']['useSortable'] = 1; } - if ($tcavalue['config']['filter']['0']['parameters']['allowedFileExtensions'] !== '') { + if (!empty($tcavalue['config']['filter']['0']['parameters']['allowedFileExtensions'])) { $allowedFileExtensions = $tcavalue['config']['filter']['0']['parameters']['allowedFileExtensions']; } else { $allowedFileExtensions = $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']; @@ -268,18 +268,18 @@ public function generateFieldsTca($tca): array // set date ranges if date or datetime field if ($fieldkey === 'config' && ($tcavalue[$fieldkey]['dbType'] === 'date' || $tcavalue[$fieldkey]['dbType'] === 'datetime')) { - if ($tcavalue[$fieldkey]['range']['upper'] !== '') { + if (!empty($tcavalue[$fieldkey]['range']['upper'])) { $date = new \DateTime($tcavalue[$fieldkey]['range']['upper']); $tcavalue[$fieldkey]['range']['upper'] = $date->getTimestamp() + 86400; } - if ($tcavalue[$fieldkey]['range']['lower'] !== '') { + if (!empty($tcavalue[$fieldkey]['range']['lower'] !== '')) { $date = new \DateTime($tcavalue[$fieldkey]['range']['lower']); $tcavalue[$fieldkey]['range']['lower'] = $date->getTimestamp() + 86400; } } // set correct rendertype if format (code highlighting) is set in text tca - if ($fieldkey === 'config' && $tcavalue[$fieldkey]['format'] !== '') { + if ($fieldkey === 'config' && !empty($tcavalue[$fieldkey]['format'])) { $tcavalue[$fieldkey]['renderType'] = 't3editor'; } diff --git a/Classes/Domain/Repository/BackendLayoutRepository.php b/Classes/Domain/Repository/BackendLayoutRepository.php index 4096e131..5c05e642 100644 --- a/Classes/Domain/Repository/BackendLayoutRepository.php +++ b/Classes/Domain/Repository/BackendLayoutRepository.php @@ -126,11 +126,11 @@ public function findIdentifierByPid($pid): ?string $backend_layout = $data['backend_layout']; $backend_layout_next_level = $data['backend_layout_next_level']; - if ($backend_layout !== '') { // If backend_layout is set on current page + if (!empty($backend_layout)) { // If backend_layout is set on current page return $backend_layout; } - if ($backend_layout_next_level !== '') { // If backend_layout_next_level is set on current page + if (!empty($backend_layout_next_level)) { // If backend_layout_next_level is set on current page return $backend_layout_next_level; } $rootLineUtility = GeneralUtility::makeInstance(RootlineUtility::class, $pid); @@ -140,7 +140,7 @@ public function findIdentifierByPid($pid): ?string $rootline = []; } foreach ($rootline as $page) { - if ($page['backend_layout_next_level'] !== '') { + if (!empty($page['backend_layout_next_level'])) { return $page['backend_layout_next_level']; } } diff --git a/Classes/ExpressionLanguage/MaskFunctionsProvider.php b/Classes/ExpressionLanguage/MaskFunctionsProvider.php index 94b38320..58f39a8e 100644 --- a/Classes/ExpressionLanguage/MaskFunctionsProvider.php +++ b/Classes/ExpressionLanguage/MaskFunctionsProvider.php @@ -37,7 +37,7 @@ protected function maskBeLayout(): ExpressionFunction } elseif ($GLOBALS['SOBE']->editconf['pages']) { // after opening pages $uid = (int)key($GLOBALS['SOBE']->editconf['pages']); } else { - if ($GLOBALS['_SERVER']['HTTP_REFERER'] !== '') { + if (!empty($GLOBALS['_SERVER']['HTTP_REFERER'])) { $url = $GLOBALS['_SERVER']['HTTP_REFERER']; $queryString = parse_url($url, PHP_URL_QUERY); $result = []; @@ -67,11 +67,11 @@ protected function maskBeLayout(): ExpressionFunction $backend_layout = $data['backend_layout']; $backend_layout_next_level = $data['backend_layout_next_level']; - if ($backend_layout !== '') { // If backend_layout is set on current page + if (!empty($backend_layout)) { // If backend_layout is set on current page return in_array($backend_layout, [$layout, 'pagets__' . $layout], true); } - if ($backend_layout_next_level !== '') { // If backend_layout_next_level is set on current page + if (!empty($backend_layout_next_level)) { // If backend_layout_next_level is set on current page return in_array($backend_layout_next_level, [$layout, 'pagets__' . $layout], true); } diff --git a/Classes/Helper/InlineHelper.php b/Classes/Helper/InlineHelper.php index f52189ed..7ef0585f 100644 --- a/Classes/Helper/InlineHelper.php +++ b/Classes/Helper/InlineHelper.php @@ -233,7 +233,7 @@ public function getInlineElements( // by default, the uid of the parent is $data["uid"] $parentUid = $data['uid']; - if ($GLOBALS['TSFE']->sys_language_uid !== 0 && $data['_LOCALIZED_UID'] !== '') { + if ($GLOBALS['TSFE']->sys_language_uid !== 0 && !empty($data['_LOCALIZED_UID'])) { $parentUid = $data['_LOCALIZED_UID']; } From a53c6502430f3bab3bc1e94c65e3025a0fe6d9a4 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Mon, 16 Mar 2020 11:47:26 +0100 Subject: [PATCH 53/93] [BUGFIX] added integer type casting --- Classes/Utility/GeneralUtility.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/Utility/GeneralUtility.php b/Classes/Utility/GeneralUtility.php index 8077bfa7..18172373 100755 --- a/Classes/Utility/GeneralUtility.php +++ b/Classes/Utility/GeneralUtility.php @@ -119,7 +119,7 @@ public function getJsOpenParamValue($fieldKey, $property, $type = 'tt_content'): foreach ($properties as $setProperty) { $keyPair = explode('=', $setProperty); if ($property === $keyPair[0]) { - $value = $keyPair[1]; + $value = (int)$keyPair[1]; break; } } From 28b812092cb543955db36973c47206c8f6ded97d Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Mon, 16 Mar 2020 11:53:51 +0100 Subject: [PATCH 54/93] [TASK] removed typolink viewhelper tag content to render pagenames by default --- Classes/CodeGenerator/HtmlCodeGenerator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/CodeGenerator/HtmlCodeGenerator.php b/Classes/CodeGenerator/HtmlCodeGenerator.php index 1378649d..a5768c6d 100644 --- a/Classes/CodeGenerator/HtmlCodeGenerator.php +++ b/Classes/CodeGenerator/HtmlCodeGenerator.php @@ -126,7 +126,7 @@ protected function generateFieldHtml($fieldKey, $elementKey, $table, $datafield break; case 'Link': $html .= '' . "\n"; - $html .= '{' . $datafield . '.' . $fieldKey . '}
          ' . "\n"; + $html .= '
          ' . "\n"; $html .= "
          \n\n"; break; case 'Select': From 1f83c821837d8221ad65268d225414caff6ec3fd Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Mon, 16 Mar 2020 15:27:57 +0100 Subject: [PATCH 55/93] [BUGFIX] add colpos 999 as allowed column for new fluidBasedPageModule --- .../View/BackendLayout/BackendLayout.php | 21 +++++++++++++++++++ ext_localconf.php | 5 ++++- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 Classes/Backend/View/BackendLayout/BackendLayout.php diff --git a/Classes/Backend/View/BackendLayout/BackendLayout.php b/Classes/Backend/View/BackendLayout/BackendLayout.php new file mode 100644 index 00000000..895eade5 --- /dev/null +++ b/Classes/Backend/View/BackendLayout/BackendLayout.php @@ -0,0 +1,21 @@ +contentIsUsed'; - + $GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][\TYPO3\CMS\Backend\View\BackendLayout\BackendLayout::class] = [ + 'className' => MASK\Mask\Backend\View\BackendLayout\BackendLayout::class + ]; + })('mask'); From fa49c3f208964a462e568799372a8ec14c8be653 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Mon, 16 Mar 2020 16:37:33 +0100 Subject: [PATCH 56/93] [BUGFIX] typo in action name --- Classes/Controller/WizardPageController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/Controller/WizardPageController.php b/Classes/Controller/WizardPageController.php index 4db29563..81e3588d 100755 --- a/Classes/Controller/WizardPageController.php +++ b/Classes/Controller/WizardPageController.php @@ -128,7 +128,7 @@ public function editAction($layoutIdentifier = null): void * @throws StopActionException * @noinspection PhpUnused */ - public function updateAtion($storage): void + public function updateAction($storage): void { $this->storageRepository->update($storage); $this->generateAction(); From 0dde3ec41379901adb1b90eca5c79f382b265349 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Mon, 16 Mar 2020 16:51:18 +0100 Subject: [PATCH 57/93] [BUGFIX] fix mask backend module for extending backendlayouts --- .../Domain/Repository/BackendLayoutRepository.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Classes/Domain/Repository/BackendLayoutRepository.php b/Classes/Domain/Repository/BackendLayoutRepository.php index 5c05e642..cc9ac226 100644 --- a/Classes/Domain/Repository/BackendLayoutRepository.php +++ b/Classes/Domain/Repository/BackendLayoutRepository.php @@ -90,12 +90,17 @@ public function findAll($pageTsPids = []): array // also search in the database for backendlayouts $databaseBackendLayouts = parent::findAll(); + /** @var \MASK\Mask\Domain\Model\BackendLayout $layout */ foreach ($databaseBackendLayouts as $layout) { - $backendLayout = new BackendLayout($layout->getUid(), - $layout->getTitle(), ''); - if ($layout->getIcon()) { - $backendLayout->setIconPath('/uploads/media/' . $layout->getIcon()); - } + $backendLayout = new BackendLayout( + $layout->getUid(), + $layout->getTitle(), + [ + 'backend_layout.' => [ + 'rows.' => [] + ] + ] + ); $backendLayout->setDescription($layout->getDescription()); $backendLayouts[$backendLayout->getIdentifier()] = $backendLayout; } From 24a591f4fc39a372722ce003e39b3e58cd67aaa3 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Mon, 16 Mar 2020 17:53:44 +0100 Subject: [PATCH 58/93] [BUGFIX] basic fixes to make TypoScript Conditions work as Symfony Expression Language --- .../CodeGenerator/TyposcriptCodeGenerator.php | 4 +- .../MaskFunctionsProvider.php | 103 ++++++++++++------ 2 files changed, 73 insertions(+), 34 deletions(-) diff --git a/Classes/CodeGenerator/TyposcriptCodeGenerator.php b/Classes/CodeGenerator/TyposcriptCodeGenerator.php index 1291d9af..59e4b6d7 100644 --- a/Classes/CodeGenerator/TyposcriptCodeGenerator.php +++ b/Classes/CodeGenerator/TyposcriptCodeGenerator.php @@ -86,7 +86,7 @@ public function generateTsConfig($json): string $content .= "}\n"; // and switch the labels depending on which content element is selected - $content .= "\n[maskContentType(\"CType|mask_" . $element['key'] . "\")]\n"; + $content .= "\n[isMaskContentType(\"CType|mask_" . $element['key'] . "\")]\n"; if ($element['columns']) { foreach ($element['columns'] as $index => $column) { $content .= ' TCEFORM.tt_content.' . $column . '.label = ' . $element['labels'][$index] . "\n"; @@ -112,7 +112,7 @@ public function generatePageTyposcript($json): string if ($json['pages']['elements']) { foreach ($json['pages']['elements'] as $element) { // Labels for pages - $pagesContent .= "\n[userFunc = maskBeLayout(" . $element['key'] . ")]\n"; + $pagesContent .= "\n[maskBeLayout(" . $element['key'] . ")]\n"; // if page has backendlayout with this element-key if ($element['columns']) { foreach ($element['columns'] as $index => $column) { diff --git a/Classes/ExpressionLanguage/MaskFunctionsProvider.php b/Classes/ExpressionLanguage/MaskFunctionsProvider.php index 58f39a8e..6778eedb 100644 --- a/Classes/ExpressionLanguage/MaskFunctionsProvider.php +++ b/Classes/ExpressionLanguage/MaskFunctionsProvider.php @@ -7,8 +7,10 @@ use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface; use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; +use TYPO3\CMS\Core\Database\Query\QueryBuilder; use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction; use TYPO3\CMS\Core\Domain\Repository\PageRepository; +use TYPO3\CMS\Core\ExpressionLanguage\RequestWrapper; use TYPO3\CMS\Core\Utility\GeneralUtility; class MaskFunctionsProvider implements ExpressionFunctionProviderInterface @@ -24,16 +26,25 @@ public function getFunctions(): array ]; } + /** + * @return ExpressionFunction + */ protected function maskBeLayout(): ExpressionFunction { return new ExpressionFunction('maskBeLayout', static function ($param) { - // Not implemented, we only use the evaluator + }, static function ($arguments, $param = null) { + + /** @var RequestWrapper $request */ + $request = $arguments['request']; + $requestParameters = $request->getQueryParams(); + + $uid = null; - $layout = $param; + $layout = (string)$param; // get current page uid: - if (is_array($_REQUEST['data']['pages'])) { // after saving page - $uid = (int)key($_REQUEST['data']['pages']); + if (is_array($requestParameters['edit']['pages'])) { // after saving page + $uid = (int)key($requestParameters['edit']['pages']); } elseif ($GLOBALS['SOBE']->editconf['pages']) { // after opening pages $uid = (int)key($GLOBALS['SOBE']->editconf['pages']); } else { @@ -64,8 +75,8 @@ protected function maskBeLayout(): ExpressionFunction )->execute() ->fetch(FetchMode::ASSOCIATIVE); - $backend_layout = $data['backend_layout']; - $backend_layout_next_level = $data['backend_layout_next_level']; + $backend_layout = (string)$data['backend_layout']; + $backend_layout_next_level = (string)$data['backend_layout_next_level']; if (!empty($backend_layout)) { // If backend_layout is set on current page return in_array($backend_layout, [$layout, 'pagets__' . $layout], true); @@ -83,7 +94,8 @@ protected function maskBeLayout(): ExpressionFunction $rootline = []; } foreach ($rootline as $page) { - if (in_array($page['backend_layout_next_level'], [$layout, 'pagets__' . $layout], true)) { + if (in_array((string)$page['backend_layout_next_level'], [$layout, 'pagets__' . $layout], + true)) { return true; } } @@ -92,37 +104,64 @@ protected function maskBeLayout(): ExpressionFunction }); } + /** + * @return ExpressionFunction + * @noinspection PhpComposerExtensionStubsInspection + */ protected function maskContentType(): ExpressionFunction { - return new ExpressionFunction('maskContentType', static function ($param) { + $getContentElementType = static function (int $uid): string { + /** @var QueryBuilder $queryBuilder */ + $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) + ->getQueryBuilderForTable('tt_content'); + /** @var DeletedRestriction $deletedRestriction */ + $deletedRestriction = GeneralUtility::makeInstance(DeletedRestriction::class); + $queryBuilder->getRestrictions() + ->removeAll() + ->add($deletedRestriction); + + return (string)$queryBuilder->select('CType') + ->from('tt_content') + ->where($queryBuilder->expr()->eq('uid', $uid)) + ->execute() + ->fetchColumn(); + }; + + return new ExpressionFunction('isMaskContentType', static function () { // Not implemented, we only use the evaluator - }, static function ($arguments, $param) { - static $cTypeCache = []; - if (isset($_REQUEST['edit']['tt_content']) && is_array($_REQUEST['edit']['tt_content'])) { - $field = explode('|', $param); - $request = $_REQUEST; - $first = array_shift($request['edit']['tt_content']); - - if ($first === 'new') { // if new element - return $_REQUEST['defVals']['tt_content']['CType'] === $field[1]; + }, static function ($arguments, $value) use ($getContentElementType) { + static $contentTypeMappingCache = []; + + /** @var RequestWrapper $request */ + $request = $arguments['request']; + $requestParameters = $request->getQueryParams(); + + if (isset($requestParameters['edit']['tt_content']) && + is_array($requestParameters['edit']['tt_content']) + ) { + $formType = (string)current($requestParameters['edit']['tt_content']); + $contentType = null; + // New record, content type (CType) given as request parameter + if ($formType === 'new' && isset($requestParameters['defVals']['tt_content']['CType'])) { + $contentType = (string)$requestParameters['defVals']['tt_content']['CType']; + } else { + // Existing record, fetch content type (CType) from database + $uid = (int)key($requestParameters['edit']['tt_content']); + $contentType = $contentTypeMappingCache[$uid] ?? $getContentElementType($uid); } - // if element exists - $uid = (int)key($_REQUEST['edit']['tt_content']); - - if (!isset($cTypeCache[$uid])) { - /** @var ConnectionPool $connection */ - $connection = GeneralUtility::makeInstance(ConnectionPool::class); - $queryBuilder = $connection->getQueryBuilderForTable('tt_content'); - /** @var DeletedRestriction $deletedRestriction */ - $deletedRestriction = GeneralUtility::makeInstance(DeletedRestriction::class); - $queryBuilder->getRestrictions()->removeAll()->add($deletedRestriction); - $cTypeCache[$uid] = $queryBuilder->select($field[0])->from('tt_content')->where($queryBuilder->expr()->eq('uid', - $uid))->execute()->fetchColumn(0); + + return $contentType === 'mask_' . $value; + } + + // Content element is loaded via ajax (inline) + $parsedBody = $request->getParsedBody(); + if (isset($parsedBody['ajax']['context'])) { + $parsedContext = json_decode($parsedBody['ajax']['context'], true, 512, JSON_THROW_ON_ERROR); + if (isset($parsedContext['config']['overrideChildTca']['columns']['CType']['config']['default'])) { + return $parsedContext['config']['overrideChildTca']['columns']['CType']['config']['default'] === 'mask_' . $value; } - return (string)$cTypeCache[$uid] === (string)$field[1]; } - // if content element is loaded by ajax, then it's ok - return is_array($_REQUEST['ajax']); + return false; }); } } From 685c19f4f77e4f6bd4785aabc6fe8f6803001822 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Tue, 17 Mar 2020 16:49:24 +0100 Subject: [PATCH 59/93] [CLEANUP] cleanup, refactoring and speed enhancements for typoscript condition maskBeLayout --- .../MaskFunctionsProvider.php | 77 ++++--------------- 1 file changed, 16 insertions(+), 61 deletions(-) diff --git a/Classes/ExpressionLanguage/MaskFunctionsProvider.php b/Classes/ExpressionLanguage/MaskFunctionsProvider.php index 6778eedb..e45777bc 100644 --- a/Classes/ExpressionLanguage/MaskFunctionsProvider.php +++ b/Classes/ExpressionLanguage/MaskFunctionsProvider.php @@ -1,4 +1,5 @@ getQueryParams(); - - - $uid = null; $layout = (string)$param; - // get current page uid: - if (is_array($requestParameters['edit']['pages'])) { // after saving page - $uid = (int)key($requestParameters['edit']['pages']); - } elseif ($GLOBALS['SOBE']->editconf['pages']) { // after opening pages - $uid = (int)key($GLOBALS['SOBE']->editconf['pages']); - } else { - if (!empty($GLOBALS['_SERVER']['HTTP_REFERER'])) { - $url = $GLOBALS['_SERVER']['HTTP_REFERER']; - $queryString = parse_url($url, PHP_URL_QUERY); - $result = []; - parse_str($queryString, $result); - if ($result['id']) { - $uid = (int)$result['id']; - } - } - } + $backend_layout = (string)$arguments['page']['backend_layout']; + $backend_layout_next_level = (string)$arguments['page']['backend_layout_next_level']; - if ($uid) { - /** @var Connection $connection */ - $connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable('pages'); - $query = $connection->createQueryBuilder(); - /** @var DeletedRestriction $deletedRestriction */ - $deletedRestriction = GeneralUtility::makeInstance(DeletedRestriction::class); - $query->getRestrictions()->removeAll()->add($deletedRestriction); - $data = $query->select( - 'backend_layout', - 'backend_layout_next_level' - )->from('pages') - ->where( - $query->expr()->eq('uid', $uid) - )->execute() - ->fetch(FetchMode::ASSOCIATIVE); - - $backend_layout = (string)$data['backend_layout']; - $backend_layout_next_level = (string)$data['backend_layout_next_level']; - - if (!empty($backend_layout)) { // If backend_layout is set on current page - return in_array($backend_layout, [$layout, 'pagets__' . $layout], true); - } + // If backend_layout is set on current page + if (!empty($backend_layout)) { + return in_array($backend_layout, [$layout, 'pagets__' . $layout], true); + } - if (!empty($backend_layout_next_level)) { // If backend_layout_next_level is set on current page - return in_array($backend_layout_next_level, [$layout, 'pagets__' . $layout], true); - } + // If backend_layout_next_level is set on current page + if (!empty($backend_layout_next_level)) { + return in_array($backend_layout_next_level, [$layout, 'pagets__' . $layout], true); + } - // If backend_layout and backend_layout_next_level is not set on current page, check backend_layout_next_level on rootline - $sysPage = GeneralUtility::makeInstance(PageRepository::class); - try { - $rootline = $sysPage->getRootLine($uid, ''); - } catch (\Exception $e) { - $rootline = []; - } - foreach ($rootline as $page) { - if (in_array((string)$page['backend_layout_next_level'], [$layout, 'pagets__' . $layout], - true)) { - return true; - } + // If backend_layout and backend_layout_next_level is not set on current page, check backend_layout_next_level on rootline + foreach ($arguments['tree']->rootLine as $page) { + if (in_array((string)$page['backend_layout_next_level'], [$layout, 'pagets__' . $layout], + true)) { + return true; } } return false; From 586861260119ee221d8c9bc4052b9225320d61c2 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Tue, 17 Mar 2020 18:17:46 +0100 Subject: [PATCH 60/93] [BUGFIX] refactored typoscript condition isMaskContentType for correct behaviour --- .../CodeGenerator/TyposcriptCodeGenerator.php | 2 +- .../MaskFunctionsProvider.php | 48 ++++++++++++------- 2 files changed, 32 insertions(+), 18 deletions(-) diff --git a/Classes/CodeGenerator/TyposcriptCodeGenerator.php b/Classes/CodeGenerator/TyposcriptCodeGenerator.php index 59e4b6d7..e1166fc0 100644 --- a/Classes/CodeGenerator/TyposcriptCodeGenerator.php +++ b/Classes/CodeGenerator/TyposcriptCodeGenerator.php @@ -86,7 +86,7 @@ public function generateTsConfig($json): string $content .= "}\n"; // and switch the labels depending on which content element is selected - $content .= "\n[isMaskContentType(\"CType|mask_" . $element['key'] . "\")]\n"; + $content .= "\n[isMaskContentType(\"mask_" . $element['key'] . "\")]\n"; if ($element['columns']) { foreach ($element['columns'] as $index => $column) { $content .= ' TCEFORM.tt_content.' . $column . '.label = ' . $element['labels'][$index] . "\n"; diff --git a/Classes/ExpressionLanguage/MaskFunctionsProvider.php b/Classes/ExpressionLanguage/MaskFunctionsProvider.php index e45777bc..5f10882e 100644 --- a/Classes/ExpressionLanguage/MaskFunctionsProvider.php +++ b/Classes/ExpressionLanguage/MaskFunctionsProvider.php @@ -61,7 +61,6 @@ protected function maskBeLayout(): ExpressionFunction /** * @return ExpressionFunction - * @noinspection PhpComposerExtensionStubsInspection */ protected function maskContentType(): ExpressionFunction { @@ -69,7 +68,6 @@ protected function maskContentType(): ExpressionFunction /** @var QueryBuilder $queryBuilder */ $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) ->getQueryBuilderForTable('tt_content'); - /** @var DeletedRestriction $deletedRestriction */ $deletedRestriction = GeneralUtility::makeInstance(DeletedRestriction::class); $queryBuilder->getRestrictions() ->removeAll() @@ -86,37 +84,53 @@ protected function maskContentType(): ExpressionFunction // Not implemented, we only use the evaluator }, static function ($arguments, $value) use ($getContentElementType) { static $contentTypeMappingCache = []; + $uid = null; /** @var RequestWrapper $request */ $request = $arguments['request']; - $requestParameters = $request->getQueryParams(); + $params = $request->getQueryParams(); - if (isset($requestParameters['edit']['tt_content']) && - is_array($requestParameters['edit']['tt_content']) + // if cType is directly in the params + if (isset($params['recordTypeValue'])) { + return $params['recordTypeValue'] === $value; + } + + // if we have info about content element + if (isset($params['edit']['tt_content']) && + is_array($params['edit']['tt_content']) ) { - $formType = (string)current($requestParameters['edit']['tt_content']); $contentType = null; // New record, content type (CType) given as request parameter - if ($formType === 'new' && isset($requestParameters['defVals']['tt_content']['CType'])) { - $contentType = (string)$requestParameters['defVals']['tt_content']['CType']; + if (isset($params['defVals']['tt_content']['CType']) && (string)current($params['edit']['tt_content']) === 'new') { + $contentType = (string)$params['defVals']['tt_content']['CType']; } else { // Existing record, fetch content type (CType) from database - $uid = (int)key($requestParameters['edit']['tt_content']); + $uid = (int)key($params['edit']['tt_content']); $contentType = $contentTypeMappingCache[$uid] ?? $getContentElementType($uid); } - - return $contentType === 'mask_' . $value; + return $contentType === $value; } - // Content element is loaded via ajax (inline) + // if content element is loaded via ajax (inline), there are two ways to find the uid of the element $parsedBody = $request->getParsedBody(); - if (isset($parsedBody['ajax']['context'])) { - $parsedContext = json_decode($parsedBody['ajax']['context'], true, 512, JSON_THROW_ON_ERROR); - if (isset($parsedContext['config']['overrideChildTca']['columns']['CType']['config']['default'])) { - return $parsedContext['config']['overrideChildTca']['columns']['CType']['config']['default'] === 'mask_' . $value; - } + if (isset($parsedBody['ajax'][1])) { + $uid = (int)$parsedBody['ajax'][1]; + } + if (isset($parsedBody['ajax'][0])) { + $uidTableString = $parsedBody['ajax'][0]; + $uidTableStringArray = explode('-', $uidTableString); + $uid = (int)array_pop($uidTableStringArray); } + + if ($uid) { + // fetch content type (CType) from database + $contentType = $contentTypeMappingCache[$uid] ?? $getContentElementType($uid); + return $contentType === $value; + } + + // if we have found nothing, then return that this is not a mask field return false; + }); } } From 21f57f4da422648692b51c17246c744af3bbba00 Mon Sep 17 00:00:00 2001 From: Nitori Date: Thu, 19 Mar 2020 23:28:56 +0100 Subject: [PATCH 61/93] Sort inline fields recursively to output correct order of fields in editor --- Classes/Controller/WizardController.php | 28 ++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/Classes/Controller/WizardController.php b/Classes/Controller/WizardController.php index e681eab4..357a820f 100755 --- a/Classes/Controller/WizardController.php +++ b/Classes/Controller/WizardController.php @@ -163,11 +163,7 @@ protected function prepareStorage(&$storage) if (is_array($field)) { if ($field["config"]["type"] == "inline") { $storage["tca"][$key]["inlineFields"] = $this->storageRepository->loadInlineFields($key); - uasort($storage["tca"][$key]["inlineFields"], function ($columnA, $columnB) { - $a = isset($columnA['order']) ? (int)$columnA['order'] : 0; - $b = isset($columnB['order']) ? (int)$columnB['order'] : 0; - return $a - $b; - }); + $this->sortInlineFieldsByOrder($storage["tca"][$key]["inlineFields"]); } } } @@ -363,4 +359,26 @@ protected function checkFolder($path, $translationKey = 'tx_mask.all.error.missi ); } } + + /** + * Sort inline fields recursively. + * + * @param array $inlineFields + */ + public function sortInlineFieldsByOrder(array &$inlineFields) + { + uasort($inlineFields, function ($columnA, $columnB) { + $a = isset($columnA['order']) ? (int)$columnA['order'] : 0; + $b = isset($columnB['order']) ? (int)$columnB['order'] : 0; + return $a - $b; + }); + + foreach ($inlineFields as $i => $field) { + if ($field["config"]["type"] == "inline") { + if (isset($inlineFields[$i]["inlineFields"]) && is_array($inlineFields[$i]["inlineFields"])) { + $this->sortInlineFieldsByOrder($inlineFields[$i]["inlineFields"]); + } + } + } + } } From 3e2bfcb99f6242114015a8915fee72cc2937adc9 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Fri, 20 Mar 2020 16:54:16 +0100 Subject: [PATCH 62/93] [TASK] more redesign --- Classes/Controller/WizardController.php | 16 +- .../Partials/WizardContent/Metadata.html | 98 ++--- .../Backend/Templates/Wizard/List.html | 390 +++++++++--------- .../Backend/Templates/WizardContent/Edit.html | 250 ++++++----- .../Backend/Templates/WizardPage/Edit.html | 144 +++---- Resources/Public/Scripts/scripts.js | 2 +- Resources/Public/Styles/styles.css | 142 +++++-- ext_tables.php | 2 +- 8 files changed, 548 insertions(+), 496 deletions(-) diff --git a/Classes/Controller/WizardController.php b/Classes/Controller/WizardController.php index 63ed48b2..8a4585b9 100755 --- a/Classes/Controller/WizardController.php +++ b/Classes/Controller/WizardController.php @@ -134,7 +134,7 @@ class WizardController extends ActionController 'preview' ]; - protected $missingFolders = false; + protected $missingFolders = []; /** * is called before every action @@ -372,12 +372,12 @@ protected function createFile($path): bool protected function checkFolder($path, $translationKey = 'tx_mask.all.error.missingjson'): void { if (!file_exists(MaskUtility::getFileAbsFileName($path))) { - $this->missingFolders = true; - $this->addFlashMessage( - LocalizationUtility::translate($translationKey, 'mask'), - $path, - AbstractMessage::WARNING - ); + $this->missingFolders[] = $path; +// $this->addFlashMessage( +// LocalizationUtility::translate($translationKey, 'mask'), +// $path, +// AbstractMessage::WARNING +// ); } } @@ -394,6 +394,8 @@ public function listAction() $storages = $this->storageRepository->load(); $backendLayouts = $this->backendLayoutRepository->findAll(explode(',', $settings['backendlayout_pids'])); $this->checkFolders(); + + $this->view->assign('missingFolders', $this->missingFolders); $this->view->assign('storages', $storages); $this->view->assign('backendLayouts', $backendLayouts); } diff --git a/Resources/Private/Backend/Partials/WizardContent/Metadata.html b/Resources/Private/Backend/Partials/WizardContent/Metadata.html index e0874217..f300690f 100644 --- a/Resources/Private/Backend/Partials/WizardContent/Metadata.html +++ b/Resources/Private/Backend/Partials/WizardContent/Metadata.html @@ -1,61 +1,51 @@ -
          + + +
          - - - -
          -
          -

          - - - erstellen -

          -
          - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - - + + + + + + - - - - - -
          - - - - - - - - - -  
          - - - - -

          + +

          + + + + + + + +  
          - {storage.label} + -
          {key} -

          -
          +

          + + {storage.label} + +
          {key} +

          +
          -

          {storage.description}

          - - - - - - -
          - - -
          - - - - - - - - - - - - - - - - - +
          +

          {storage.description}

          + + + + + - - - - +
          + + +
          + + + + + + + + + + + + + + + + + + + + + +
          +
          + + + Neues Inhaltselement anlegen +
          - - - Neues Inhaltselement anlegen - -
          -
          + +
          +
        -
        -

        - - - erweitern -

        - - - - - - - -
        - - - - - - - - - - - +
        +

        + + + erweitern +

        + + + + + + + +
        +
        - - - - - -  
        + - + + + + + + + + + - - - + - - - -
        - - - - - + + + + + + +  
        + + + + + - - - - -

        - -
        {layout.identifier} -

        -
        -

        {layout.description}

        -
        - - - - - + + +
        + +

        + +
        {layout.identifier} +

        - -
        -
        -
        -
        -
        - developed by
        -
        - - + +

        {layout.description}

        + +
        + + + + + + +
        + + + + + +
        + + +
        + developed by
        + + + +
        -
        - -

        - - diff --git a/Resources/Private/Backend/Templates/WizardContent/Edit.html b/Resources/Private/Backend/Templates/WizardContent/Edit.html index c57c7a7c..0cc9182f 100644 --- a/Resources/Private/Backend/Templates/WizardContent/Edit.html +++ b/Resources/Private/Backend/Templates/WizardContent/Edit.html @@ -2,148 +2,146 @@ {namespace core = TYPO3\CMS\Core\ViewHelpers} - - -
        -
        -
        - -

        {storage.label} {storage.key}

        - - - -
        -
        -
          - -
        -
        - -
        -
        -
        -
          - -
        • -
          -
          - -
          -
          + + + +
          +
          +

          + + {storage.label} {storage.key}

          + +
          + +
          +
          +
          +
          +
            + +
          +
          + +
          +
            + +
          • +
            +
            + +
            +
            - + - - + + {keyText} - -
            -
            + +
            +
            - - -
            -
            - -
            -
              - - - -
            -
            -
            -
          • -
            -
          -
          -
          - - - - - - - - - -
          + + +
          +
          + +
          +
            + + + +
          +
          +
          +
        • +
          +
        +
        +
        +
        + + + + + + + + + +
        - -
        -
        - -
        - -
        -

        - - -   -

        -

        {key}

        -
        -
        -
        + +
        +
        + +
        + +
        +

        + + +   +

        +

        {key}

        +
        +
        +
        -
        -
        - -
        -
        - - - - - - -
        -
        -
        -
        +
        +
        + +
        +
        + + + + + + +
        - - - -
        -
        - - - +
        +
        +
        + + +
        + + diff --git a/Resources/Private/Backend/Templates/WizardPage/Edit.html b/Resources/Private/Backend/Templates/WizardPage/Edit.html index 45e0ee71..ca558bda 100644 --- a/Resources/Private/Backend/Templates/WizardPage/Edit.html +++ b/Resources/Private/Backend/Templates/WizardPage/Edit.html @@ -2,95 +2,87 @@ {namespace core = TYPO3\CMS\Core\ViewHelpers} - - -
        -
        -
        - -

        - -

        - - - -
        -
        -
          - -
        -
        - -
        -
        + +

        + {backendLayout.title} +

        + + + +
        +
        +
          + +
        +
        + +
        +
        -
        -
          - -
        • -
          -
          - -
          -
          +
          +
            + +
          • +
            +
            + +
            +
            - + - - + + {field.key} -
            -
            +
            +
            - - -
            -
            - -
            -
              - - - -
            -
            -
            -
          • -
            -
          -
          - -
          - - - - - - -
          -
          - + + +
          +
        + +
        +
          + + + +
        +
        +
        +

      • +
        +
      +
      - +
      + + + + + +
      + + + diff --git a/Resources/Public/Scripts/scripts.js b/Resources/Public/Scripts/scripts.js index 47e89a84..355af423 100644 --- a/Resources/Public/Scripts/scripts.js +++ b/Resources/Public/Scripts/scripts.js @@ -70,7 +70,7 @@ jQuery(document).ready(function () { }); // 1st column click - jQuery(".tx_mask_tabcell1").on("click", "LI", function (event) { + jQuery(".tx_mask_tabcell4 .tx_mask_field_templates").on("click", "LI", function (event) { // search for active field var activeFound = false; diff --git a/Resources/Public/Styles/styles.css b/Resources/Public/Styles/styles.css index 8c5727ba..65ae2238 100644 --- a/Resources/Public/Styles/styles.css +++ b/Resources/Public/Styles/styles.css @@ -6,7 +6,7 @@ Mask @media (min-width: 768px) { .tx_mask_borderright { - border-right: 1px solid #a2aab8; + /*border-right: 1px solid #a2aab8;*/ } } @@ -21,11 +21,11 @@ Mask display: table; width: 100%; margin-bottom: 4px; - background-color: #efefef; + background-color: #fff; cursor: move; height: 37px; - border-radius: 2px; - box-shadow: 0 1px 2px rgba(0, 0, 0, 0.13); + /*border-radius: 2px;*/ + /*box-shadow: 0 1px 2px rgba(0, 0, 0, 0.13);*/ } .tx_mask_btn_row { @@ -83,13 +83,13 @@ Mask width: 100%; } -.tx_mask_tabcell1 .dragtarget { +.tx_mask_field_templates .dragtarget { display: none; } .tx_mask_tabcell2 > .dragtarget { display: block; - padding-bottom: 50px; + min-height: 70px !important; } .tx_mask_tabcell2 UL .dragtarget { @@ -103,10 +103,10 @@ Mask } .tx_mask_tabcell2 UL.tx_mask_fieldtypes LI .id_typetext, -.tx_mask_tabcell1 UL.tx_mask_fieldtypes LI .id_labeltext, -.tx_mask_tabcell1 UL.tx_mask_fieldtypes LI .id_keytext, -.tx_mask_tabcell1 UL.tx_mask_fieldtypes LI .id_delete, -.tx_mask_tabcell1 UL.tx_mask_fieldtypes LI .id_move, +UL.tx_mask_fieldtypes.tx_mask_field_templates LI .id_labeltext, +UL.tx_mask_fieldtypes.tx_mask_field_templates LI .id_keytext, +UL.tx_mask_fieldtypes.tx_mask_field_templates LI .id_delete, +UL.tx_mask_fieldtypes.tx_mask_field_templates LI .id_move, .tx_mask_tabcell2 UL.tx_mask_fieldtypes LI .id_add { display: none; } @@ -184,6 +184,12 @@ UL.tx_mask_fieldtypes LI .id_keytext { margin-top: 12px; } +.tx_mask_tabcell1 { + background: #f2f2f2; + padding: 35px 25px !important; + height: 100%; +} + .tx_mask_tabcell1 .btn-success { margin: 5px 0; } @@ -199,7 +205,7 @@ UL.tx_mask_fieldtypes LI .id_keytext { } .tx_mask_tabcell2 LI.active, .tx_mask_tabcell2 LI:hover { - background-color: #DEDEDE; + background-color: #F2F2F2; } .icon-size-default { @@ -216,25 +222,29 @@ UL.tx_mask_fieldtypes .tx_mask_fieldcontent_highlight { list-style: none; } -.tx_mask_tabcell1 LI { - font-family: 'Source Sans Pro',sans-serif; +.tx_mask_field_templates LI { + font-family: 'Source Sans Pro', sans-serif; font-size: 1.2em; - background: #6f6f6f; + background: #fff; box-shadow: none; color: #4c4c4c; font-weight: bold; + width: 37px; + float: left; + margin: 2px 3px; } -.tx_mask_tabcell1 LI .tx_mask_btn_actions { +.tx_mask_field_templates LI .tx_mask_btn_actions { cursor: hand; cursor: pointer; display: none; } .row.bench { - margin-top: 5px; - border-top: 1px solid #ccc; - padding-top: 19px; + margin-top: -25px; + height: calc(100vh - 40px); + overflow: hidden; + margin-left: -25px; } .panel-space { @@ -246,6 +256,7 @@ UL.tx_mask_fieldtypes .tx_mask_fieldcontent_highlight { padding: 20px; border-bottom: 1px solid #ccc; border-right: 1px solid #ccc; + background: #fafafa; } .tx_mask_fieldcontent LABEL.check-item { @@ -710,53 +721,69 @@ UL.tx_mask_fieldtypes .tx_mask_fieldcontent_highlight { font-family: FontAwesome !important; } -.tx_mask_tabcell1 .id_String { +.tx_mask_field_templates .id_String { background: #51b3ad; } -.tx_mask_tabcell1 .id_Integer { + +.tx_mask_field_templates .id_Integer { background: #f98e71; } -.tx_mask_tabcell1 .id_Float { + +.tx_mask_field_templates .id_Float { background: #f4a863; } -.tx_mask_tabcell1 .id_Link { + +.tx_mask_field_templates .id_Link { background: #7fbacd; } -.tx_mask_tabcell1 .id_Date { + +.tx_mask_field_templates .id_Date { background: #e17764; } -.tx_mask_tabcell1 .id_Datetime { + +.tx_mask_field_templates .id_Datetime { background: #de87b5; } -.tx_mask_tabcell1 .id_Text { + +.tx_mask_field_templates .id_Text { background: #6599bc; } -.tx_mask_tabcell1 .id_Richtext { + +.tx_mask_field_templates .id_Richtext { background: #6eb47c; } -.tx_mask_tabcell1 .id_Check { + +.tx_mask_field_templates .id_Check { background: #a4ce8d; } -.tx_mask_tabcell1 .id_Radio { + +.tx_mask_field_templates .id_Radio { background: #f8d760; } -.tx_mask_tabcell1 .id_Select { + +.tx_mask_field_templates .id_Select { background: #b9cc70; } -.tx_mask_tabcell1 .id_File { + +.tx_mask_field_templates .id_File { background: #8db3f4; } -.tx_mask_tabcell1 .id_Inline { + +.tx_mask_field_templates .id_Inline { background: #9c97ce; } -.tx_mask_tabcell1 .id_Content { + +.tx_mask_field_templates .id_Content { background: #95a9af; } -.tx_mask_tabcell1 .id_Tab { + +.tx_mask_field_templates .id_Tab { background: #837e76; } -.tx_mask_tabcell1 .tx_mask_btn_row .tx_mask_btn_text { + +.tx_mask_field_templates .tx_mask_btn_row .tx_mask_btn_text { background: #ffffffba; + display: none; } #typo3-inner-docbody { @@ -980,3 +1007,50 @@ img.brand-logo { max-width: 150px; } } + +.fa.fa-plus-circle { + color: #4c7e3a; +} + +.module-docheader { + display: none; +} + +.module-body { + padding-top: 25px !important; +} + +.tx_mask_tabcell2, .tx_mask_tabcell3 { + padding-top: 65px; +} + +.form-group.col-sm-12.tx_mask_borderright.tx_mask_tabcell2 { + overflow: auto; + height: auto; + padding: 11px; + margin: 0; + background: #e8e8e8; +} + +.tx_mask_tabcell5 { + margin: 12px 0 !important; + padding: 0 !important; +} + +.col-sm-4.tx_mask_tabcell4 { + /*background: #717171;*/ +} + +.form-control-wrap { + margin: 9px 0 12px 0 !important; +} + +.tx_mask_tabcell1 label { + margin-bottom: 0 !important; +} + +.tx_mask_tabcell1 > DIV { + + margin-top: 0; + +} diff --git a/ext_tables.php b/ext_tables.php index 88be3a19..0376f0ec 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -14,7 +14,7 @@ 'mask', // Submodule key 'top', // Position [ - \MASK\Mask\Controller\WizardController::class => 'list', + \MASK\Mask\Controller\WizardController::class => 'list,createMissingFolders', \MASK\Mask\Controller\WizardContentController::class => 'list, new, create, edit, update, delete, purge, generate, showHtml, createMissingFolders, hide, activate, createHtml', \MASK\Mask\Controller\WizardPageController::class => 'list, new, create, edit, update, delete, showHtml', ], [ From 243a985f20c14537c374861edaa447e54ed5a373 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Fri, 20 Mar 2020 16:59:34 +0100 Subject: [PATCH 63/93] [CLEANUP] cleanup styles.css for backend module --- Resources/Public/Styles/styles.css | 662 +++++++++++------------------ 1 file changed, 251 insertions(+), 411 deletions(-) diff --git a/Resources/Public/Styles/styles.css b/Resources/Public/Styles/styles.css index 65ae2238..5569cada 100644 --- a/Resources/Public/Styles/styles.css +++ b/Resources/Public/Styles/styles.css @@ -1,31 +1,16 @@ -@charset "utf-8"; - -/* -Mask -*/ - -@media (min-width: 768px) { - .tx_mask_borderright { - /*border-right: 1px solid #a2aab8;*/ - } -} - -/* Filedtype Buttons */ .tx_mask_btn, .tx_mask_fieldtypes { list-style-type: none; - padding: 0; margin: 0; + padding: 0; } .tx_mask_btn { - display: table; - width: 100%; - margin-bottom: 4px; - background-color: #fff; + background: #fff; cursor: move; + display: table; height: 37px; - /*border-radius: 2px;*/ - /*box-shadow: 0 1px 2px rgba(0, 0, 0, 0.13);*/ + margin-bottom: 4px; + width: 100%; } .tx_mask_btn_row { @@ -33,21 +18,21 @@ Mask } .tx_mask_btn_caption { - display: table-caption; caption-side: bottom; + display: table-caption; } -.id_Inline .tx_mask_btn_caption { - padding-left: 5px; +.id_inline .tx_mask_btn_caption { + background: #ededed; border-left: 2px solid #9c97ce; - background-color: #ededed; + padding-left: 5px; } -.tx_mask_btn_row > DIV { +.tx_mask_btn_row > div { display: table-cell; } -.tx_mask_btn_row IMG { +.tx_mask_btn_row img { vertical-align: bottom; } @@ -55,139 +40,109 @@ Mask width: 37px; } -.tx_mask_btn_row .tx_mask_btn_img IMG, .tx_mask_fieldheader IMG { +.tx_mask_btn_row .tx_mask_btn_img img, .tx_mask_fieldheader img { border-radius: 2px; } .tx_mask_btn_row .tx_mask_btn_text { - vertical-align: middle; padding-left: 13px; + vertical-align: middle; } .tx_mask_btn_row .tx_mask_btn_actions { - width: 69px; + padding-right: 10px; text-align: right; vertical-align: middle; - padding-right: 10px; -} - -.tx_mask_tabcell2 .tx_mask_btn { - cursor: hand; - cursor: pointer; + width: 69px; } .tx_mask_btn .dragtarget { display: block; - padding: 0; margin: 0; + padding: 0; width: 100%; } -.tx_mask_field_templates .dragtarget { - display: none; -} - .tx_mask_tabcell2 > .dragtarget { display: block; min-height: 70px !important; } -.tx_mask_tabcell2 UL .dragtarget { +.tx_mask_tabcell2 ul .dragtarget { min-height: 38px; } -.tx_mask_tabcell2 UL .dragtarget li.tx_mask_btn { - margin-top: 3px; - margin-bottom: 0px; +.tx_mask_tabcell2 ul .dragtarget li.tx_mask_btn { border-bottom: 2px solid #fafafa; + margin-bottom: 0; + margin-top: 3px; } -.tx_mask_tabcell2 UL.tx_mask_fieldtypes LI .id_typetext, -UL.tx_mask_fieldtypes.tx_mask_field_templates LI .id_labeltext, -UL.tx_mask_fieldtypes.tx_mask_field_templates LI .id_keytext, -UL.tx_mask_fieldtypes.tx_mask_field_templates LI .id_delete, -UL.tx_mask_fieldtypes.tx_mask_field_templates LI .id_move, -.tx_mask_tabcell2 UL.tx_mask_fieldtypes LI .id_add { - display: none; -} - -/* Field header */ .tx_mask_fieldheader { - padding-bottom: 6px; - margin-bottom: 14px; height: 50px; + margin-bottom: 14px; + padding-bottom: 6px; } .tx_mask_fieldheader_icon { - min-height: 32px; - width: 32px; - margin-right: 7px; float: left; margin-right: 16px; + min-height: 32px; + width: 32px; } .tx_mask_fieldheader_text { min-height: 32px; } -.tx_mask_fieldheader_text H1 { - font-size: 165%; +.tx_mask_fieldheader_text h1 { font-family: Share, Verdana, Arial, Helvetica, sans-serif; - font-weight: normal; + font-size: 165%; + font-weight: 400; margin: 0; - padding: 0; overflow: hidden; + padding: 0; text-overflow: ellipsis; white-space: nowrap; } -.tx_mask_fieldheader_text P { +.tx_mask_fieldheader_text p { font-size: 100%; - font-weight: normal; + font-weight: 400; margin: 0; padding: 0; } -/* Texts */ -UL.tx_mask_fieldtypes LI .id_typetext { - /*font-size: 120%;*/ +ul.tx_mask_fieldtypes li .id_typetext { line-height: 220%; } -UL.tx_mask_fieldtypes LI .id_labeltext { +ul.tx_mask_fieldtypes li .id_labeltext { + color: #525252; display: block; + font-family: 'Source Sans-Pro', sans-serif; font-size: 13px; - font-weight: bold; - color: #525252; - text-overflow: ellipsis; + font-weight: 700; + max-width: 220px; overflow: hidden; + text-overflow: ellipsis; white-space: nowrap; - max-width: 220px; - font-family: 'Source Sans-Pro', sans-serif; } -UL.tx_mask_fieldtypes LI .id_keytext { - font-size: 10px; - display: block; +ul.tx_mask_fieldtypes li .id_keytext { color: #525252; + display: block; + font-size: 10px; } -.tx_mask_fieldcontent_existing { - display: none; -} - -.tx_mask_field { - display: none; -} - -.tx_mask_tabcell1 > DIV { - margin-top: 12px; +.tx_mask_tabcell1 > div { + margin-top: 0; } .tx_mask_tabcell1 { background: #f2f2f2; - padding: 35px 25px !important; height: 100%; + padding: 35px 25px !important; } .tx_mask_tabcell1 .btn-success { @@ -195,56 +150,48 @@ UL.tx_mask_fieldtypes LI .id_keytext { } .tx_mask_tabcell3 { - padding: 0 20px 0 20px; -} - -UL.tx_mask_fieldtypes LI .id_keytext { - font-size: 10px; - display: block; - color: #525252; + padding: 0 20px; } -.tx_mask_tabcell2 LI.active, .tx_mask_tabcell2 LI:hover { - background-color: #F2F2F2; +.tx_mask_tabcell2 li.active, .tx_mask_tabcell2 li:hover { + background: #F2F2F2; } .icon-size-default { height: 37px !important; - width: 37px !important; line-height: 37px !important; + width: 37px !important; } -UL.tx_mask_fieldtypes .tx_mask_fieldcontent_highlight { - height: 37px; - /* background-color: #ddd;*/ +ul.tx_mask_fieldtypes .tx_mask_fieldcontent_highlight { border: 1px dashed #aaa; - margin-bottom: 3px; + height: 37px; list-style: none; + margin-bottom: 3px; } -.tx_mask_field_templates LI { - font-family: 'Source Sans Pro', sans-serif; - font-size: 1.2em; +.tx_mask_field_templates li { background: #fff; box-shadow: none; color: #4c4c4c; - font-weight: bold; - width: 37px; float: left; + font-family: 'Source Sans Pro', sans-serif; + font-size: 1.2em; + font-weight: 700; margin: 2px 3px; + width: 37px; } -.tx_mask_field_templates LI .tx_mask_btn_actions { - cursor: hand; +.tx_mask_field_templates li .tx_mask_btn_actions { cursor: pointer; display: none; } .row.bench { - margin-top: -25px; height: calc(100vh - 40px); - overflow: hidden; margin-left: -25px; + margin-top: -25px; + overflow: hidden; } .panel-space { @@ -252,16 +199,16 @@ UL.tx_mask_fieldtypes .tx_mask_fieldcontent_highlight { } .tx_mask_fieldcontent.tab-content { - border-left: 1px solid #ccc; - padding: 20px; + background: #fafafa; border-bottom: 1px solid #ccc; + border-left: 1px solid #ccc; border-right: 1px solid #ccc; - background: #fafafa; + padding: 20px; } -.tx_mask_fieldcontent LABEL.check-item { +.tx_mask_fieldcontent label.check-item { float: left; - margin: 11px 11px; + margin: 11px; } .tx_mask_fieldcontent .t3js-formengine-field-item.check-item { @@ -273,129 +220,117 @@ UL.tx_mask_fieldtypes .tx_mask_fieldcontent_highlight { } .element-hidden { - opacity: 0.4; -webkit-filter: saturate(0); filter: saturate(0); + opacity: 0.4; } -/* fontIconPicker main CSS file {@link https://github.com/micc83/fontIconPicker} */ .icons-selector * { - margin: 0; - padding: 0; border: 0; font: inherit; + font-family: HelveticaNeue-Light, "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; + margin: 0; + padding: 0; vertical-align: baseline; - font-family: HelveticaNeue-Light, "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif } .icons-selector, .icons-selector *, .icons-selector :after, .icons-selector :before, .icons-selector:after, .icons-selector:before { - -webkit-box-sizing: content-box; -moz-box-sizing: content-box; - box-sizing: content-box + -webkit-box-sizing: content-box; + box-sizing: content-box; } .icons-selector { display: inline-block; + text-align: left; vertical-align: middle; - text-align: left } .icons-selector .selector { + background: #fefefe; + border: 1px solid #bbb; + border-radius: 2px; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + height: 32px; + transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; width: 100px; - height: 32px } .icons-selector .selector-button { - width: 39px; - height: 100%; + cursor: pointer; display: block; + float: left; + height: 100%; text-align: center; - cursor: pointer; - float: left + width: 39px; } .icons-selector .selector-button i { line-height: 32px; - text-align: center + text-align: center; } .icons-selector .selected-icon { display: block; - width: 60px; - height: 100%; float: left; - text-align: center + height: 100%; + text-align: center; + width: 60px; } .icons-selector .selected-icon i { - line-height: 32px; + cursor: default; font-size: 18px; - cursor: default + line-height: 32px; } .icons-selector .selector-popup { - position: absolute; - z-index: 10000; - background-color: #fefefe; - padding: 5px; + background: #fefefe; height: auto; + margin-top: -1px; + padding: 5px; + position: absolute; width: 342px; - margin-top: -1px + z-index: 10000; } .icons-selector .selector-category select, .icons-selector .selector-search input[type=text] { - border: 0; - line-height: 20px; - padding: 10px 2.5%; - width: 100%; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; + border: 0; box-sizing: border-box; - margin-bottom: 5px; + display: block; font-size: 12px; - display: block + line-height: 20px; + margin-bottom: 5px; + padding: 10px 2.5%; + width: 100%; } .icons-selector .selector-category select { - height: 40px + height: 40px; } .icons-selector .selector-category select option { - padding: 10px -} - -.icons-selector input::-webkit-input-placeholder { - text-transform: uppercase -} - -.icons-selector input:-moz-placeholder { - text-transform: uppercase -} - -.icons-selector input::-moz-placeholder { - text-transform: uppercase -} - -.icons-selector input:-ms-input-placeholder { - text-transform: uppercase + padding: 10px; } .icons-selector .selector-search { - position: relative + position: relative; } .icons-selector .selector-search i { position: absolute; right: 10px; - top: 7px + top: 7px; } .icons-selector .fip-icons-container { - width: 100%; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; - padding: 5px + padding: 5px; + width: 100%; } .icons-selector .fip-icons-container .loading { @@ -403,95 +338,83 @@ UL.tx_mask_fieldtypes .tx_mask_fieldcontent_highlight { margin: 0 auto; padding: 20px 0; text-align: center; - width: 100% + width: 100%; } .icons-selector .fip-box { + cursor: pointer; display: inline-block; - margin: 2px; - width: 60px; + height: 40px; line-height: 42px; + margin: 2px; text-align: center; - cursor: pointer; vertical-align: top; - height: 40px + width: 60px; } .icons-selector .selector-footer { line-height: 12px; padding: 5px 5px 0; - text-align: center + text-align: center; } .icons-selector .selector-footer, .icons-selector .selector-footer i { - font-size: 14px -} - -.icons-selector .selector-arrows { - float: right + font-size: 14px; } .icons-selector .selector-pages { + float: left; font-size: 11px; - float: left -} - -.icons-selector .selector-arrows i { - cursor: pointer } .icons-selector .selector-footer em { - font-style: italic -} - -.icons-selector .icons-picker-error i:before { - color: #eee + font-style: italic; } .icons-selector [class*=" fip-icon-"]:before, .icons-selector [class^=fip-icon-]:before { - font-family: iconpicker; + display: inline-block; + font-family: iconpicker, sans-serif; font-style: normal; + font-variant: normal; font-weight: 400; - speak: none; - display: inline-block; - text-decoration: inherit; - width: 1em; + line-height: 1em; + margin-left: .2em; margin-right: .2em; + speak: none; text-align: center; - font-variant: normal; + text-decoration: inherit; text-transform: none; - line-height: 1em; - margin-left: .2em + width: 1em; } .icons-selector .icons-selector .fip-icon-cancel:before { content: '\e814'; - cursor: pointer + cursor: pointer; } .icons-selector .fip-icon-block:before { + color: #fed0d0; content: '\e84e'; - color: #fed0d0 } .icons-selector .fip-icon-down-dir:before { - content: '\e800' + content: '\e800'; } .icons-selector .fip-icon-up-dir:before { - content: '\e813' + content: '\e813'; } .icons-selector .fip-icon-left-dir:before { - content: '\e801' + content: '\e801'; } .icons-selector .fip-icon-right-dir:before { - content: '\e802' + content: '\e802'; } .icons-selector .fip-icon-spin3:before { - content: '\e815' + content: '\e815'; } .icons-selector .fip-icon-spin3 { @@ -577,210 +500,138 @@ UL.tx_mask_fieldtypes .tx_mask_fieldcontent_highlight { } } -/* Grey Theme file for fontIconPicker {@link https://github.com/micc83/fontIconPicker} */ .fip-grey.icons-selector { - font-size: 16px -} - -.fip-grey.icons-selector .selector { + font-size: 16px; } .fip-grey.icons-selector .selector-button { - background-color: #F4F4F4; - border-left: 1px solid #E1E1E1 + background: #F4F4F4; + border-left: 1px solid #E1E1E1; } .fip-grey.icons-selector .selector-button:hover { - background-color: #f1f1f1 + background: #f1f1f1; } .fip-grey.icons-selector .selector-button:hover i { - color: #999 + color: #999; } .fip-grey.icons-selector .selector-button i { color: #aaa; - text-shadow: 0 1px 0 #FFF + text-shadow: 0 1px 0 #FFF; } .fip-grey.icons-selector .selected-icon i { - color: #404040 + color: #404040; } .fip-grey.icons-selector .selector-popup { -moz-box-shadow: 0 1px 1px rgba(0, 0, 0, .04); -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .04); + border: 1px solid #E5E5E5; box-shadow: 0 1px 1px rgba(0, 0, 0, .04); - border: 1px solid #E5E5E5 } .fip-grey.icons-selector .selector-category select, .fip-grey.icons-selector .selector-search input[type=text] { - border: 1px solid #EDEDED; - color: #404040; -moz-box-shadow: none; -webkit-box-shadow: none; + border: 1px solid #EDEDED; box-shadow: none; - outline: 0 -} - -.fip-grey.icons-selector input::-webkit-input-placeholder { - color: #ddd -} - -.fip-grey.icons-selector input:-moz-placeholder { - color: #ddd -} - -.fip-grey.icons-selector input::-moz-placeholder { - color: #ddd + color: #404040; + outline: 0; } .fip-grey.icons-selector input:-ms-input-placeholder { - color: #ddd !important -} - -.fip-grey.icons-selector .selector-search i { - color: #eee + color: #ddd !important; } .fip-grey.icons-selector .fip-icons-container { - background-color: #fff; - border: 1px solid #EDEDED -} - -.fip-grey.icons-selector .fip-icons-container .loading { - color: #eee + background: #fff; + border: 1px solid #EDEDED; } .fip-grey.icons-selector .fip-box { - border: 1px solid #EFEFEF + border: 1px solid #EFEFEF; } .fip-grey.icons-selector .fip-box:hover { - background-color: #f6f6f6 -} - -.fip-grey.icons-selector .selector-footer, .fip-grey.icons-selector .selector-footer i { - color: #ddd + background: #f6f6f6; } .fip-grey.icons-selector .selector-arrows i:hover { - color: #777 + color: #777; } .fip-grey.icons-selector span.current-icon, .fip-grey.icons-selector span.current-icon:hover { - background-color: #2EA2CC; + background: #2EA2CC; + border: 1px solid #298CBA; color: #fff; - border: 1px solid #298CBA -} - -.fip-grey.icons-selector .icons-picker-error i:before { - color: #eee -} - -#meta_icon { - display: none; } .icons-selector i, .selector-footer i { + /*noinspection CssNoGenericFontName*/ font-family: FontAwesome !important; } -.icons-selector .selector { - height: 32px; - background-color: #fefefe; - background-image: none; - border: 1px solid #bbbbbb; - border-radius: 2px; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); - transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; -} - .fip-icon-right-dir:before { content: "\f061" !important; + /*noinspection CssNoGenericFontName*/ font-family: FontAwesome !important; } .fip-icon-left-dir:before { content: "\f060" !important; + /*noinspection CssNoGenericFontName*/ font-family: FontAwesome !important; } .fip-icon-block:before { content: "\f00d" !important; + /*noinspection CssNoGenericFontName*/ font-family: FontAwesome !important; } .fip-icon-down-dir:before { content: "\f078" !important; + /*noinspection CssNoGenericFontName*/ font-family: FontAwesome !important; } .fip-icon-up-dir:before { content: "\f077" !important; + /*noinspection CssNoGenericFontName*/ font-family: FontAwesome !important; } -.tx_mask_field_templates .id_String { - background: #51b3ad; -} - -.tx_mask_field_templates .id_Integer { +.tx_mask_field_templates .id_integer { background: #f98e71; } -.tx_mask_field_templates .id_Float { +.tx_mask_field_templates .id_float { background: #f4a863; } -.tx_mask_field_templates .id_Link { - background: #7fbacd; -} - -.tx_mask_field_templates .id_Date { +.tx_mask_field_templates .id_date { background: #e17764; } -.tx_mask_field_templates .id_Datetime { +.tx_mask_field_templates .id_datetime { background: #de87b5; } -.tx_mask_field_templates .id_Text { - background: #6599bc; -} - -.tx_mask_field_templates .id_Richtext { - background: #6eb47c; -} - -.tx_mask_field_templates .id_Check { +.tx_mask_field_templates .id_check { background: #a4ce8d; } -.tx_mask_field_templates .id_Radio { +.tx_mask_field_templates .id_radio { background: #f8d760; } -.tx_mask_field_templates .id_Select { +.tx_mask_field_templates .id_select { background: #b9cc70; } -.tx_mask_field_templates .id_File { - background: #8db3f4; -} - -.tx_mask_field_templates .id_Inline { - background: #9c97ce; -} - -.tx_mask_field_templates .id_Content { - background: #95a9af; -} - -.tx_mask_field_templates .id_Tab { - background: #837e76; -} - .tx_mask_field_templates .tx_mask_btn_row .tx_mask_btn_text { background: #ffffffba; display: none; @@ -795,8 +646,8 @@ thead th { } table .btn-add { - margin: 8px auto; display: block; + margin: 8px auto; width: 270px; } @@ -805,38 +656,36 @@ h1 .icon.t3js-icon { } .imprint { - text-align: right; - margin-top: 70px; - letter-spacing: 2px; - font-size: 11px; - font-family: 'Source Sans Pro', sans-serif; - line-height: 11px; color: #797979; filter: saturate(0); + font-family: 'Source Sans Pro', sans-serif; + font-size: 11px; + letter-spacing: 2px; + line-height: 11px; + margin-top: 70px; + text-align: right; } img.brand-logo { width: 100px; } - .mask_issues_container { float: right !important; } .mask_issues { - background-color: #DDDDDD; + background: #DDD; } .mask_issues_img { - width: 30px; height: 30px; - padding: 1px; - padding-right: 10px; + padding: 1px 10px 1px 1px; + width: 30px; } .mask_issues_text { - font-weight: bold; + font-weight: 700; margin-left: 10px; } @@ -849,7 +698,7 @@ img.brand-logo { } .mask_footer_h_spacer { - height: 0px; + height: 0; max-width: 2%; } @@ -881,22 +730,22 @@ img.brand-logo { .mask_footer_heading { color: #CB0036; - line-height: 10px; - font-weight: bold; font-size: 16px; + font-weight: 700; + line-height: 10px; margin-top: 0; } .mask_footer_btn { - outline: none; + background: #CB0036; border: none; - background-color: #CB0036; - color: white; + color: #FFF; font-size: 14px; + font-weight: 700; line-height: 28px; - font-weight: bold; - text-transform: uppercase; min-width: 140px; + outline: none; + text-transform: uppercase; } .mask_footer_no_hover:hover { @@ -908,18 +757,18 @@ img.brand-logo { } .mask_footer_img_1 { - width: 63%; height: auto; - padding-top: 2.5%; padding-left: 2%; padding-right: 5%; + padding-top: 2.5%; + width: 63%; } .mask_footer_img_2 { + height: auto; margin-left: 1%; margin-top: 2%; width: 35%; - height: auto; } .mask_footer_tvc_text { @@ -928,10 +777,6 @@ img.brand-logo { top: 7.5%; } -.mask_footer_link { - float: right; -} - .mask_footer_red { color: #CB0036; } @@ -941,28 +786,75 @@ img.brand-logo { } .mask_footer_img_0 { - width: 90%; height: auto; - padding-top: 4%; - padding-left: 2%; - padding-right: 5%; - padding-bottom: 2%; max-width: 280px; + padding: 4% 5% 2% 2%; + width: 90%; +} + +.fa.fa-plus-circle { + color: #4c7e3a; +} + +.module-body { + padding-top: 25px !important; +} + +.tx_mask_tabcell2, .tx_mask_tabcell3 { + padding-top: 65px; +} + +.form-group.col-sm-12.tx_mask_borderright.tx_mask_tabcell2 { + background: #e8e8e8; + height: auto; + margin: 0; + overflow: auto; + padding: 11px; +} + +.tx_mask_tabcell5 { + margin: 12px 0 !important; + padding: 0 !important; +} + +.form-control-wrap { + margin: 9px 0 12px !important; +} + +.tx_mask_tabcell1 label { + margin-bottom: 0 !important; +} + +.tx_mask_tabcell2 .tx_mask_btn, .icons-selector .selector-arrows i { + cursor: pointer; +} + +.tx_mask_field_templates .dragtarget, .tx_mask_tabcell2 ul.tx_mask_fieldtypes li .id_typetext, ul.tx_mask_fieldtypes.tx_mask_field_templates li .id_labeltext, ul.tx_mask_fieldtypes.tx_mask_field_templates li .id_keytext, ul.tx_mask_fieldtypes.tx_mask_field_templates li .id_delete, ul.tx_mask_fieldtypes.tx_mask_field_templates li .id_move, .tx_mask_tabcell2 ul.tx_mask_fieldtypes li .id_add, .tx_mask_fieldcontent_existing, .tx_mask_field, #meta_icon, .module-docheader { + display: none; +} + +.icons-selector input::-webkit-input-placeholder, .icons-selector input:-moz-placeholder, .icons-selector input::-moz-placeholder, .icons-selector input:-ms-input-placeholder { + text-transform: uppercase; +} + +.icons-selector .selector-arrows, .mask_footer_link { + float: right; +} + +.icons-selector .icons-picker-error i:before, .fip-grey.icons-selector .selector-search i, .fip-grey.icons-selector .fip-icons-container .loading, .fip-grey.icons-selector .icons-picker-error i:before { + color: #eee; +} + +.fip-grey.icons-selector input::-webkit-input-placeholder, .fip-grey.icons-selector input:-moz-placeholder, .fip-grey.icons-selector input::-moz-placeholder, .fip-grey.icons-selector .selector-footer, .fip-grey.icons-selector .selector-footer i { + color: #ddd; } @media screen and (max-width: 1200px) { + .mask_footer_spacer_2 { margin-right: 0 !important; } - .mask_footer_img_0 { - max-width: 50%; - } - - .mask_footer_img_1 { - max-width: 50%; - } - .mask_footer_img_2 { width: 24%; } @@ -975,82 +867,30 @@ img.brand-logo { max-width: 460px; min-width: 100px; } + + .mask_footer_img_0, .mask_footer_img_1 { + max-width: 50%; + } } @media screen and (max-width: 800px) { + .mask_footer_img_container { max-width: 50%; } - .mask_footer_mask { - margin: 0 !important; - min-width: 300px; + .mask_footer_img_2 { + max-width: 150px; + width: 45%; } - .mask_footer_tvc { + .mask_footer_mask, .mask_footer_tvc { margin: 0 !important; min-width: 300px; } - .mask_footer_img_0 { - width: 90%; + .mask_footer_img_0, .mask_footer_img_1 { max-width: 330px; - } - - .mask_footer_img_1 { width: 90%; - max-width: 330px; - } - - .mask_footer_img_2 { - width: 45%; - max-width: 150px; } } - -.fa.fa-plus-circle { - color: #4c7e3a; -} - -.module-docheader { - display: none; -} - -.module-body { - padding-top: 25px !important; -} - -.tx_mask_tabcell2, .tx_mask_tabcell3 { - padding-top: 65px; -} - -.form-group.col-sm-12.tx_mask_borderright.tx_mask_tabcell2 { - overflow: auto; - height: auto; - padding: 11px; - margin: 0; - background: #e8e8e8; -} - -.tx_mask_tabcell5 { - margin: 12px 0 !important; - padding: 0 !important; -} - -.col-sm-4.tx_mask_tabcell4 { - /*background: #717171;*/ -} - -.form-control-wrap { - margin: 9px 0 12px 0 !important; -} - -.tx_mask_tabcell1 label { - margin-bottom: 0 !important; -} - -.tx_mask_tabcell1 > DIV { - - margin-top: 0; - -} From fa876d54dc77b9e7c9ea7a94cfc0950908bb47b3 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Mon, 23 Mar 2020 16:04:39 +0100 Subject: [PATCH 64/93] [TASK] added mask info cards --- .../Backend/Templates/Wizard/List.html | 44 ++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/Resources/Private/Backend/Templates/Wizard/List.html b/Resources/Private/Backend/Templates/Wizard/List.html index f4eb217b..d4094c39 100644 --- a/Resources/Private/Backend/Templates/Wizard/List.html +++ b/Resources/Private/Backend/Templates/Wizard/List.html @@ -209,9 +209,51 @@

      developed by
      - +
      +
      + +
      +
      + webprofil +
      +
      +

      You like Mask?

      + +
      + + +
      +
      +
      +
      + +
      +
      + TV-Converter +
      +
      +

      TemplaVoila to Mask?

      + +
      + + +
      +
      +
      +
      +

      From 0609fac4d92dcf77ce6cb7bd1b1caf3cb2775206 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Mon, 23 Mar 2020 16:50:30 +0100 Subject: [PATCH 65/93] [TASK] unify redesign in all views --- .../Backend/Templates/WizardContent/New.html | 55 +++++----- .../Backend/Templates/WizardPage/Edit.html | 101 +++++++++--------- 2 files changed, 77 insertions(+), 79 deletions(-) diff --git a/Resources/Private/Backend/Templates/WizardContent/New.html b/Resources/Private/Backend/Templates/WizardContent/New.html index bbc07c1e..67a92ef5 100644 --- a/Resources/Private/Backend/Templates/WizardContent/New.html +++ b/Resources/Private/Backend/Templates/WizardContent/New.html @@ -2,40 +2,35 @@ {namespace core = TYPO3\CMS\Core\ViewHelpers} - - -
      -
      -
      - -

      + + + +
      +
      +

      - - - -
      -
      -
        - -
      -
      - -
      -
      - -
      -
        -
        - -
        -
        -
        - - +
        +
        +
          + +
        +
        + +
        +
          +
          +
          +
          + + + diff --git a/Resources/Private/Backend/Templates/WizardPage/Edit.html b/Resources/Private/Backend/Templates/WizardPage/Edit.html index ca558bda..a6d018d1 100644 --- a/Resources/Private/Backend/Templates/WizardPage/Edit.html +++ b/Resources/Private/Backend/Templates/WizardPage/Edit.html @@ -3,73 +3,77 @@ -

          - {backendLayout.title} -

          - +
          -
            - -
          -
          +

          + {backendLayout.title} +

          + +
          - -
          -
            - -
          • -
            -
            - -
            -
            +
            +
            +
              + +
            +
            + +
            +
              + +
            • +
              +
              + +
              +
              - + - - + + {field.key} -
              -
              +
              +
              - - + + +
              -
            - -
            -
              - - - -
            -
            -
            -
          • -
            -
          + +
          +
            + + + +
          +
          +
          + + + +
          -
          @@ -81,7 +85,6 @@

          - From b5a6dc543c0209bc108798f7bc4943c2b24b1290 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Mon, 23 Mar 2020 16:50:47 +0100 Subject: [PATCH 66/93] [BUGFIX] fix wrong redirect after save and close --- Classes/Controller/WizardController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/Controller/WizardController.php b/Classes/Controller/WizardController.php index 8a4585b9..3c3599c7 100755 --- a/Classes/Controller/WizardController.php +++ b/Classes/Controller/WizardController.php @@ -285,7 +285,7 @@ protected function redirectByAction(): void $this->redirect('edit', null, null, $arguments); } else { if (key_exists('saveAndExit', $formAction)) { - $this->redirect('list'); + $this->redirect('list', 'Wizard'); } } } From adb5ffb9c855d00cb966c586c4c5bc972f8fe66f Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Mon, 23 Mar 2020 17:34:49 +0100 Subject: [PATCH 67/93] [TASK] adding subtitles and labels for better UI --- .../Forms/General/FormTypeButton.html | 3 +- .../Backend/Templates/WizardContent/Edit.html | 3 +- .../Backend/Templates/WizardContent/New.html | 3 +- .../Backend/Templates/WizardPage/Edit.html | 3 +- Resources/Public/Styles/styles.css | 30 ++++++++++++++++++- 5 files changed, 37 insertions(+), 5 deletions(-) diff --git a/Resources/Private/Backend/Partials/Forms/General/FormTypeButton.html b/Resources/Private/Backend/Partials/Forms/General/FormTypeButton.html index 10c94502..4ab978c2 100644 --- a/Resources/Private/Backend/Partials/Forms/General/FormTypeButton.html +++ b/Resources/Private/Backend/Partials/Forms/General/FormTypeButton.html @@ -1,5 +1,6 @@ {namespace core = TYPO3\CMS\Core\ViewHelpers} -
        • +
        • +
          diff --git a/Resources/Private/Backend/Templates/WizardContent/Edit.html b/Resources/Private/Backend/Templates/WizardContent/Edit.html index 0cc9182f..72721fe6 100644 --- a/Resources/Private/Backend/Templates/WizardContent/Edit.html +++ b/Resources/Private/Backend/Templates/WizardContent/Edit.html @@ -16,12 +16,13 @@

          +
          - +
            diff --git a/Resources/Private/Backend/Templates/WizardContent/New.html b/Resources/Private/Backend/Templates/WizardContent/New.html index 67a92ef5..75f8c34d 100644 --- a/Resources/Private/Backend/Templates/WizardContent/New.html +++ b/Resources/Private/Backend/Templates/WizardContent/New.html @@ -16,12 +16,13 @@

          +
          - +
            diff --git a/Resources/Private/Backend/Templates/WizardPage/Edit.html b/Resources/Private/Backend/Templates/WizardPage/Edit.html index a6d018d1..50a41c03 100644 --- a/Resources/Private/Backend/Templates/WizardPage/Edit.html +++ b/Resources/Private/Backend/Templates/WizardPage/Edit.html @@ -17,12 +17,13 @@

          • +
            - +
              diff --git a/Resources/Public/Styles/styles.css b/Resources/Public/Styles/styles.css index 5569cada..3fe5b4f7 100644 --- a/Resources/Public/Styles/styles.css +++ b/Resources/Public/Styles/styles.css @@ -78,6 +78,15 @@ margin-top: 3px; } +.tx_mask_tabcell4 { + padding-top: 10px; +} + +.tx_mask_tabcell4 > label { + display: block; + color: #495460; +} + .tx_mask_fieldheader { height: 50px; margin-bottom: 14px; @@ -813,7 +822,7 @@ img.brand-logo { } .tx_mask_tabcell5 { - margin: 12px 0 !important; + margin: 0 0 30px 0; padding: 0 !important; } @@ -894,3 +903,22 @@ img.brand-logo { width: 90%; } } + +.mask_tooltip { + position: relative; +} + +.mask_tooltip .tooltiptext { + visibility: hidden; + width: 120px; + color: #555; + text-align: center; + position: absolute; + z-index: 1; + bottom: -27px; + left: -41px; +} + +.tx_mask_field_templates .mask_tooltip:hover .tooltiptext { + visibility: visible; +} From d1f0b04aea88c804e2abd077e97d4c09513174a8 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Wed, 8 Apr 2020 14:17:28 +0200 Subject: [PATCH 68/93] [TASK] more minor css adjustments --- Resources/Public/Styles/styles.css | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/Resources/Public/Styles/styles.css b/Resources/Public/Styles/styles.css index 3fe5b4f7..3d51ef2c 100644 --- a/Resources/Public/Styles/styles.css +++ b/Resources/Public/Styles/styles.css @@ -5,7 +5,8 @@ } .tx_mask_btn { - background: #fff; + background: #f2f2f2; + /*border: none !important;*/ cursor: move; display: table; height: 37px; @@ -13,6 +14,10 @@ width: 100%; } +/*.tx_mask_tabcell2 .tx_mask_btn {*/ +/* border: 1px solid #bbb;*/ +/*}*/ + .tx_mask_btn_row { display: table-row; } @@ -40,9 +45,9 @@ width: 37px; } -.tx_mask_btn_row .tx_mask_btn_img img, .tx_mask_fieldheader img { - border-radius: 2px; -} +/*.tx_mask_btn_row .tx_mask_btn_img img, .tx_mask_fieldheader img {*/ +/* border-radius: 2px;*/ +/*}*/ .tx_mask_btn_row .tx_mask_btn_text { padding-left: 13px; @@ -80,6 +85,8 @@ .tx_mask_tabcell4 { padding-top: 10px; + height: 100%; + overflow: auto; } .tx_mask_tabcell4 > label { @@ -159,11 +166,13 @@ ul.tx_mask_fieldtypes li .id_keytext { } .tx_mask_tabcell3 { - padding: 0 20px; + height: 100%; + background: #f2f2f2; + padding: 30px !important; } .tx_mask_tabcell2 li.active, .tx_mask_tabcell2 li:hover { - background: #F2F2F2; + background: #eaf4fd; } .icon-size-default { @@ -197,7 +206,7 @@ ul.tx_mask_fieldtypes .tx_mask_fieldcontent_highlight { } .row.bench { - height: calc(100vh - 40px); + height: calc(100vh); margin-left: -25px; margin-top: -25px; overflow: hidden; @@ -809,16 +818,16 @@ img.brand-logo { padding-top: 25px !important; } -.tx_mask_tabcell2, .tx_mask_tabcell3 { +.tx_mask_tabcell2 { padding-top: 65px; } .form-group.col-sm-12.tx_mask_borderright.tx_mask_tabcell2 { - background: #e8e8e8; + background: none; height: auto; margin: 0; - overflow: auto; padding: 11px; + border: 1px dashed #bbb; } .tx_mask_tabcell5 { From cf397decb51e13ebdd37d819397d9149959412ad Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Wed, 8 Apr 2020 14:23:03 +0200 Subject: [PATCH 69/93] [TASK] change sponsoring link and description --- Resources/Private/Backend/Templates/Wizard/List.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Resources/Private/Backend/Templates/Wizard/List.html b/Resources/Private/Backend/Templates/Wizard/List.html index d4094c39..d395d3ce 100644 --- a/Resources/Private/Backend/Templates/Wizard/List.html +++ b/Resources/Private/Backend/Templates/Wizard/List.html @@ -214,7 +214,7 @@

            -
            @@ -222,11 +222,11 @@

            src="/typo3conf/ext/mask/Resources/Public/Images/Logo_WEBprofil_T3camp_druck.png" alt="webprofil">

            -

            You like Mask?

            +

            You want to reuse your content elements in your next project?

            -
            From 1b24a0163adaeade4bbe61124a71bec66ebfb04e Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Wed, 8 Apr 2020 15:56:05 +0200 Subject: [PATCH 70/93] [BUGFIX] fix missing repeatable styles --- Resources/Public/Styles/styles.css | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Resources/Public/Styles/styles.css b/Resources/Public/Styles/styles.css index 3d51ef2c..0a3c3a65 100644 --- a/Resources/Public/Styles/styles.css +++ b/Resources/Public/Styles/styles.css @@ -75,14 +75,19 @@ .tx_mask_tabcell2 ul .dragtarget { min-height: 38px; + padding: 5px; + border: 1px dashed #bbb; } - .tx_mask_tabcell2 ul .dragtarget li.tx_mask_btn { border-bottom: 2px solid #fafafa; margin-bottom: 0; margin-top: 3px; } +.id_Inline .tx_mask_btn_caption { + border-left: 4px solid #9e97d1; +} + .tx_mask_tabcell4 { padding-top: 10px; height: 100%; From d78d6d35190d9e6f709ccc16afc02e19f98abd7e Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Wed, 8 Apr 2020 16:40:31 +0200 Subject: [PATCH 71/93] [BUGFIX] make method parameter optional to prevent error on call --- Classes/Controller/WizardController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Classes/Controller/WizardController.php b/Classes/Controller/WizardController.php index 3daf495f..aa0c9f72 100755 --- a/Classes/Controller/WizardController.php +++ b/Classes/Controller/WizardController.php @@ -246,7 +246,7 @@ public function checkFieldKey(ServerRequest $request, Response $response): Respo * @throws Exception * @noinspection PhpUnused */ - public function checkElementKey(ServerRequest $request, Response $response): Response + public function checkElementKey(ServerRequest $request, Response $response = null): Response { $elementKey = $request->getQueryParams()['key']; @@ -400,7 +400,7 @@ public function sortInlineFieldsByOrder(array &$inlineFields) } } } - + /** * action list * From 8d3b3e2b99f006c93577e21382636421205de65b Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Wed, 8 Apr 2020 16:40:53 +0200 Subject: [PATCH 72/93] [CLEANUP] remove obsolete tca settings --- Classes/CodeGenerator/TcaCodeGenerator.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Classes/CodeGenerator/TcaCodeGenerator.php b/Classes/CodeGenerator/TcaCodeGenerator.php index 4df43315..a4ffc2c0 100644 --- a/Classes/CodeGenerator/TcaCodeGenerator.php +++ b/Classes/CodeGenerator/TcaCodeGenerator.php @@ -362,9 +362,6 @@ public function generateTableTca($table, $tca): void 'dynamicConfigFile' => '', 'iconfile' => '' ], - 'interface' => [ - 'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, ', - ], 'types' => [ '1' => ['showitem' => 'sys_language_uid;;;;1-1-1, l10n_parent, l10n_diffsource, hidden;;1, --div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access, starttime, endtime'], ], @@ -391,7 +388,6 @@ public function generateTableTca($table, $tca): void ], 'l10n_parent' => [ 'displayCond' => 'FIELD:sys_language_uid:>:0', - 'exclude' => 1, 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent', 'config' => [ 'type' => 'select', @@ -529,8 +525,6 @@ public function generateTableTca($table, $tca): void $tableTca['ctrl']['title'] = $table; $tableTca['ctrl']['label'] = $labelField; $tableTca['ctrl']['searchFields'] = implode(',', $fields); - $tableTca['interface']['showRecordFieldList'] = 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, ' - . implode(', ', $fields); $tableTca['types']['1']['showitem'] = $prependTabs . implode(', ', $fields) . ', --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'; From b5fc6955c018a2c70a9d3de2794fa4252847d913 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Wed, 8 Apr 2020 16:41:07 +0200 Subject: [PATCH 73/93] [TASK] adjust styling to new backend look --- Resources/Public/Styles/styles.css | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Resources/Public/Styles/styles.css b/Resources/Public/Styles/styles.css index 0a3c3a65..54873e76 100644 --- a/Resources/Public/Styles/styles.css +++ b/Resources/Public/Styles/styles.css @@ -45,9 +45,9 @@ width: 37px; } -/*.tx_mask_btn_row .tx_mask_btn_img img, .tx_mask_fieldheader img {*/ -/* border-radius: 2px;*/ -/*}*/ +.tx_mask_btn_row .tx_mask_btn_img img, .tx_mask_fieldheader img, .icon-module-tools_MaskMask img { + border-radius: 2px; +} .tx_mask_btn_row .tx_mask_btn_text { padding-left: 13px; @@ -78,6 +78,7 @@ padding: 5px; border: 1px dashed #bbb; } + .tx_mask_tabcell2 ul .dragtarget li.tx_mask_btn { border-bottom: 2px solid #fafafa; margin-bottom: 0; From a87581c3722a76472e4e097a0eceea25e708707d Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Wed, 8 Apr 2020 17:51:43 +0200 Subject: [PATCH 74/93] [CLEANUP] replaced global extension key variable with string --- ext_emconf.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext_emconf.php b/ext_emconf.php index ddfb1ff8..3c04dec1 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -1,5 +1,5 @@ 'Mask', 'description' => 'Create your own content elements and page templates. Easy to use, even without programming skills because of the comfortable drag and drop system. Stored in structured database tables. Style your frontend with Fluid tags. Ideal, if you want to switch from Templavoila.', 'category' => 'plugin', From f9809a3a6a55cd71e55ccdface161d05c8f69de0 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Wed, 8 Apr 2020 17:52:03 +0200 Subject: [PATCH 75/93] [BUGFIX] fix broken purge action after redesign --- Resources/Private/Backend/Templates/Wizard/List.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/Private/Backend/Templates/Wizard/List.html b/Resources/Private/Backend/Templates/Wizard/List.html index d395d3ce..444b543c 100644 --- a/Resources/Private/Backend/Templates/Wizard/List.html +++ b/Resources/Private/Backend/Templates/Wizard/List.html @@ -110,7 +110,7 @@

            - +

            From e7b96d14de11a393a9c3585dfd44508c64be1716 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Wed, 8 Apr 2020 17:54:13 +0200 Subject: [PATCH 76/93] [TASK] show flash messages as javascript toasts --- Resources/Public/Scripts/scripts.js | 11 +++++++++++ Resources/Public/Styles/styles.css | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Resources/Public/Scripts/scripts.js b/Resources/Public/Scripts/scripts.js index 355af423..60eb7598 100644 --- a/Resources/Public/Scripts/scripts.js +++ b/Resources/Public/Scripts/scripts.js @@ -1,5 +1,6 @@ jQuery.noConflict(); jQuery(document).ready(function () { + showMessages(); // delete modal of content elements jQuery(document).on("click", ".deleteCe", function (event) { @@ -784,3 +785,13 @@ function showInlineContainer(body) { jQuery(head).removeClass("existing_inline"); } } + +function showMessages() { + require(['TYPO3/CMS/Backend/Notification'], function (Notification) { + let messages = jQuery('.typo3-messages > div'); + jQuery.each(messages, function (index, message) { + let text = jQuery(message).find('.alert-message').html(); + Notification.success(text); + }); + }); +} diff --git a/Resources/Public/Styles/styles.css b/Resources/Public/Styles/styles.css index 54873e76..91d8a7e5 100644 --- a/Resources/Public/Styles/styles.css +++ b/Resources/Public/Styles/styles.css @@ -819,7 +819,9 @@ img.brand-logo { .fa.fa-plus-circle { color: #4c7e3a; } - +.typo3-messages { + display: none; +} .module-body { padding-top: 25px !important; } From 2bd2a848391a19b941cfcf75320a41d6ed0c20c1 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Wed, 8 Apr 2020 18:07:26 +0200 Subject: [PATCH 77/93] [TASK] minor styling adjustments for list view --- .../Private/Backend/Templates/Wizard/List.html | 18 +++++++++--------- Resources/Public/Styles/styles.css | 11 ++++++++++- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/Resources/Private/Backend/Templates/Wizard/List.html b/Resources/Private/Backend/Templates/Wizard/List.html index 444b543c..0be64161 100644 --- a/Resources/Private/Backend/Templates/Wizard/List.html +++ b/Resources/Private/Backend/Templates/Wizard/List.html @@ -3,7 +3,7 @@
            -

            +

            Mask @@ -206,14 +206,7 @@

            -
            -
            + +
            + developed by
            + + + +

            diff --git a/Resources/Public/Styles/styles.css b/Resources/Public/Styles/styles.css index 91d8a7e5..0d208c2f 100644 --- a/Resources/Public/Styles/styles.css +++ b/Resources/Public/Styles/styles.css @@ -686,10 +686,17 @@ h1 .icon.t3js-icon { font-size: 11px; letter-spacing: 2px; line-height: 11px; - margin-top: 70px; text-align: right; } +.card-container.sponsor-card-container { + margin-top: 70px; +} + +.list-headline { + margin-top: 30px; +} + img.brand-logo { width: 100px; } @@ -819,9 +826,11 @@ img.brand-logo { .fa.fa-plus-circle { color: #4c7e3a; } + .typo3-messages { display: none; } + .module-body { padding-top: 25px !important; } From 421c192428b00a5b378449d733b7b6ab53126ccc Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Wed, 8 Apr 2020 18:44:26 +0200 Subject: [PATCH 78/93] [BUGFIX] check for null value to prevent exception --- Classes/Imaging/IconProvider/ContentElementIconProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/Imaging/IconProvider/ContentElementIconProvider.php b/Classes/Imaging/IconProvider/ContentElementIconProvider.php index aff9a7aa..9d9b841a 100644 --- a/Classes/Imaging/IconProvider/ContentElementIconProvider.php +++ b/Classes/Imaging/IconProvider/ContentElementIconProvider.php @@ -166,7 +166,7 @@ protected function isPreviewIconAvailable($key): bool */ protected function isFontAwesomeKeyAvailable($element): bool { - return trim($element['icon']) !== ''; + return isset($element['icon']) && trim($element['icon']) !== ''; } /** From d8dfaccf2f805a05a9f1a6c459be22ee6c83730f Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Wed, 8 Apr 2020 18:44:44 +0200 Subject: [PATCH 79/93] [BUGFIX] replace property with name attribute --- .../Backend/Partials/WizardContent/Metadata.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Resources/Private/Backend/Partials/WizardContent/Metadata.html b/Resources/Private/Backend/Partials/WizardContent/Metadata.html index f300690f..7f4758b3 100644 --- a/Resources/Private/Backend/Partials/WizardContent/Metadata.html +++ b/Resources/Private/Backend/Partials/WizardContent/Metadata.html @@ -5,7 +5,7 @@
            @@ -16,7 +16,7 @@
            @@ -26,7 +26,7 @@
            -
            @@ -36,7 +36,7 @@
            - @@ -53,7 +53,7 @@
            -
            @@ -65,7 +65,7 @@
            -
            From 8dfeef43c9da613fd6d21e7e058f87eced154eaa Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Wed, 8 Apr 2020 18:45:12 +0200 Subject: [PATCH 80/93] [TASK] allow title and message in toasts --- Resources/Public/Scripts/scripts.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Resources/Public/Scripts/scripts.js b/Resources/Public/Scripts/scripts.js index 60eb7598..e1fd0857 100644 --- a/Resources/Public/Scripts/scripts.js +++ b/Resources/Public/Scripts/scripts.js @@ -790,8 +790,9 @@ function showMessages() { require(['TYPO3/CMS/Backend/Notification'], function (Notification) { let messages = jQuery('.typo3-messages > div'); jQuery.each(messages, function (index, message) { + let title = jQuery(message).find('.alert-title').html(); let text = jQuery(message).find('.alert-message').html(); - Notification.success(text); + Notification.success(title, text); }); }); } From ec559b9134a4c566d504e0491c7432db62f3b31f Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Wed, 8 Apr 2020 18:45:33 +0200 Subject: [PATCH 81/93] [BUGFIX] add missing label to addHtml Button --- Resources/Private/Backend/Templates/Wizard/List.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Resources/Private/Backend/Templates/Wizard/List.html b/Resources/Private/Backend/Templates/Wizard/List.html index 0be64161..264f72ad 100644 --- a/Resources/Private/Backend/Templates/Wizard/List.html +++ b/Resources/Private/Backend/Templates/Wizard/List.html @@ -75,8 +75,8 @@

            {storage.description}

            - - + + Fehlende HTML-Datei anlegen From 744c2a04cad65f20f10ebe5ac746909d8b98ff9d Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Wed, 8 Apr 2020 18:45:47 +0200 Subject: [PATCH 82/93] [TASK] add message when new html is created --- Classes/Controller/WizardContentController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Classes/Controller/WizardContentController.php b/Classes/Controller/WizardContentController.php index 3a8aaf97..e7763025 100755 --- a/Classes/Controller/WizardContentController.php +++ b/Classes/Controller/WizardContentController.php @@ -224,6 +224,7 @@ protected function deleteHtml($key): void protected function createHtmlAction($key): void { $html = $this->htmlCodeGenerator->generateHtml($key, 'tt_content'); + $this->addFlashMessage('Datei wurde angelegt'); $this->saveHtml($key, $html); $this->redirect('list', 'Wizard'); } From 6c2a7c6d5b090cccf28f499d9025742ae9d89447 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Thu, 9 Apr 2020 11:00:45 +0200 Subject: [PATCH 83/93] [TASK] design fine tuning --- Resources/Private/Backend/Templates/Wizard/List.html | 5 +++++ Resources/Private/Backend/Templates/WizardContent/Edit.html | 2 +- Resources/Public/Styles/styles.css | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Resources/Private/Backend/Templates/Wizard/List.html b/Resources/Private/Backend/Templates/Wizard/List.html index 264f72ad..38f94724 100644 --- a/Resources/Private/Backend/Templates/Wizard/List.html +++ b/Resources/Private/Backend/Templates/Wizard/List.html @@ -2,6 +2,11 @@ {namespace core = TYPO3\CMS\Core\ViewHelpers} +

            diff --git a/Resources/Private/Backend/Templates/WizardContent/Edit.html b/Resources/Private/Backend/Templates/WizardContent/Edit.html index 72721fe6..2bf55f49 100644 --- a/Resources/Private/Backend/Templates/WizardContent/Edit.html +++ b/Resources/Private/Backend/Templates/WizardContent/Edit.html @@ -9,7 +9,7 @@

            - {storage.label} {storage.key}

            + {storage.label}

            diff --git a/Resources/Public/Styles/styles.css b/Resources/Public/Styles/styles.css index 0d208c2f..02068a4d 100644 --- a/Resources/Public/Styles/styles.css +++ b/Resources/Public/Styles/styles.css @@ -687,6 +687,7 @@ h1 .icon.t3js-icon { letter-spacing: 2px; line-height: 11px; text-align: right; + margin-bottom: 50px; } .card-container.sponsor-card-container { @@ -833,6 +834,7 @@ img.brand-logo { .module-body { padding-top: 25px !important; + overflow-y: hidden !important; } .tx_mask_tabcell2 { @@ -846,6 +848,9 @@ img.brand-logo { padding: 11px; border: 1px dashed #bbb; } +.icon-size-large .icon-unify { + font-size: 35px !important; +} .tx_mask_tabcell5 { margin: 0 0 30px 0; From e673768ac275380931aa39841b3151df8a9218cc Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Thu, 9 Apr 2020 11:57:57 +0200 Subject: [PATCH 84/93] [TASK] change version to 5.0.0 --- Documentation/Index.rst | 2 +- Documentation/Settings.yml | 4 ++-- ext_emconf.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Documentation/Index.rst b/Documentation/Index.rst index cd70828d..75f0eea4 100644 --- a/Documentation/Index.rst +++ b/Documentation/Index.rst @@ -17,7 +17,7 @@ Mask mask :Version: - |4.1.2| + |5.0.0| :Language: en diff --git a/Documentation/Settings.yml b/Documentation/Settings.yml index 3a47174a..e4a24157 100644 --- a/Documentation/Settings.yml +++ b/Documentation/Settings.yml @@ -8,9 +8,9 @@ --- conf.py: - copyright: 2019 + copyright: 2020 project: mask - version: 4.1.2 + version: 5.0.0 release: intersphinx_mapping: t3tsref: diff --git a/ext_emconf.php b/ext_emconf.php index 3c04dec1..a0e2c399 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -16,7 +16,7 @@ 'modify_tables' => '', 'clearCacheOnLoad' => 1, 'lockType' => '', - 'version' => '4.1.2', + 'version' => '5.0.0', 'constraints' => [ 'depends' => [ 'typo3' => '10.3.0-10.4.99', From 184a12edcbb95ea8657ddf2c1ff406199b5339f6 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Thu, 9 Apr 2020 14:26:49 +0200 Subject: [PATCH 85/93] [TASK] remove deprecated replace in composer.json and add extension-key extra --- composer.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index bdba5c51..ae03162f 100644 --- a/composer.json +++ b/composer.json @@ -32,12 +32,16 @@ "typo3/cms-extbase": "10.3.*@dev || dev-master" }, "replace": { - "mask": "self.version", "typo3-ter/mask": "self.version" }, "autoload": { "psr-4": { "MASK\\Mask\\": "Classes/" } + }, + "extra": { + "typo3/cms": { + "extension-key": "mask" + } } } From fffbf46ecbb5743b63576a727fd5f6ae7f625c47 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Thu, 9 Apr 2020 14:53:48 +0200 Subject: [PATCH 86/93] [TASK] moving text to locallang and translate it --- Classes/Controller/WizardContentController.php | 2 +- .../Private/Backend/Templates/Wizard/List.html | 6 +++--- .../Backend/Templates/WizardContent/Edit.html | 4 ++-- .../Backend/Templates/WizardContent/New.html | 4 ++-- .../Backend/Templates/WizardPage/Edit.html | 2 +- Resources/Private/Language/de.locallang.xlf | 15 +++++++++++++++ Resources/Private/Language/locallang.xlf | 18 ++++++++++++++++++ 7 files changed, 42 insertions(+), 9 deletions(-) diff --git a/Classes/Controller/WizardContentController.php b/Classes/Controller/WizardContentController.php index e7763025..8854406a 100755 --- a/Classes/Controller/WizardContentController.php +++ b/Classes/Controller/WizardContentController.php @@ -224,7 +224,7 @@ protected function deleteHtml($key): void protected function createHtmlAction($key): void { $html = $this->htmlCodeGenerator->generateHtml($key, 'tt_content'); - $this->addFlashMessage('Datei wurde angelegt'); + $this->addFlashMessage(LocalizationUtility::translate('tx_mask.content.createdHtml', 'mask')); $this->saveHtml($key, $html); $this->redirect('list', 'Wizard'); } diff --git a/Resources/Private/Backend/Templates/Wizard/List.html b/Resources/Private/Backend/Templates/Wizard/List.html index 38f94724..09a1020a 100644 --- a/Resources/Private/Backend/Templates/Wizard/List.html +++ b/Resources/Private/Backend/Templates/Wizard/List.html @@ -34,7 +34,7 @@

            - erstellen +

            @@ -125,7 +125,7 @@

            @@ -137,7 +137,7 @@

            - erweitern +

            diff --git a/Resources/Private/Backend/Templates/WizardContent/Edit.html b/Resources/Private/Backend/Templates/WizardContent/Edit.html index 2bf55f49..301561a2 100644 --- a/Resources/Private/Backend/Templates/WizardContent/Edit.html +++ b/Resources/Private/Backend/Templates/WizardContent/Edit.html @@ -16,13 +16,13 @@

            - +
            - +
              diff --git a/Resources/Private/Backend/Templates/WizardContent/New.html b/Resources/Private/Backend/Templates/WizardContent/New.html index 75f8c34d..ec68fe59 100644 --- a/Resources/Private/Backend/Templates/WizardContent/New.html +++ b/Resources/Private/Backend/Templates/WizardContent/New.html @@ -16,13 +16,13 @@

            - +
            - +
              diff --git a/Resources/Private/Backend/Templates/WizardPage/Edit.html b/Resources/Private/Backend/Templates/WizardPage/Edit.html index 50a41c03..73f8a296 100644 --- a/Resources/Private/Backend/Templates/WizardPage/Edit.html +++ b/Resources/Private/Backend/Templates/WizardPage/Edit.html @@ -17,7 +17,7 @@

              - +
                diff --git a/Resources/Private/Language/de.locallang.xlf b/Resources/Private/Language/de.locallang.xlf index 21c4e9b5..e571cd84 100644 --- a/Resources/Private/Language/de.locallang.xlf +++ b/Resources/Private/Language/de.locallang.xlf @@ -559,6 +559,21 @@ Backend-Layout wurde aktualisert. + + erstellen + + + Neues Inhaltselement anlegen + + + Felder des Elements + + + Felder hinzufügen + + + Datei wurde angelegt. + diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf index 97047bc3..249db213 100644 --- a/Resources/Private/Language/locallang.xlf +++ b/Resources/Private/Language/locallang.xlf @@ -549,6 +549,24 @@ Backend-Layout was updated. + + + + + + + + Create new content element + + + Fields of this element + + + Add new fields + + + File was created. + From 0fcbd412c07418a04832118e5d0f30d82fe86ede Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Tue, 21 Apr 2020 12:00:02 +0200 Subject: [PATCH 87/93] [BUGFIX] fix padding in typo3 10.4 --- Resources/Public/Styles/styles.css | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Resources/Public/Styles/styles.css b/Resources/Public/Styles/styles.css index 02068a4d..d7daf27a 100644 --- a/Resources/Public/Styles/styles.css +++ b/Resources/Public/Styles/styles.css @@ -213,8 +213,7 @@ ul.tx_mask_fieldtypes .tx_mask_fieldcontent_highlight { .row.bench { height: calc(100vh); - margin-left: -25px; - margin-top: -25px; + margin: 0; overflow: hidden; } From b5abca1085820ede6ba816097ad502cc91aaf3fe Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Fri, 24 Apr 2020 10:24:30 +0200 Subject: [PATCH 88/93] [TASK] move mask backend module to the bottom of the admin tools menu --- ext_tables.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext_tables.php b/ext_tables.php index 0376f0ec..9337ab07 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -12,7 +12,7 @@ $extkey, 'tools', // Make module a submodule of 'admin' 'mask', // Submodule key - 'top', // Position + 'bottom', // Position [ \MASK\Mask\Controller\WizardController::class => 'list,createMissingFolders', \MASK\Mask\Controller\WizardContentController::class => 'list, new, create, edit, update, delete, purge, generate, showHtml, createMissingFolders, hide, activate, createHtml', From bbab43f2aafab83e798d6c5717e73442e180a499 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Tue, 28 Apr 2020 11:55:11 +0200 Subject: [PATCH 89/93] [BUGFIX] replaced JSON_THROW_ON_ERROR with integer to prevent error in PHP 7.2, fixes #275, #277 --- Classes/Domain/Repository/StorageRepository.php | 4 ++-- Classes/ItemsProcFuncs/CTypeList.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Classes/Domain/Repository/StorageRepository.php b/Classes/Domain/Repository/StorageRepository.php index b6179c3d..a2913a8a 100644 --- a/Classes/Domain/Repository/StorageRepository.php +++ b/Classes/Domain/Repository/StorageRepository.php @@ -93,7 +93,7 @@ public function load(): array if (!empty($this->extSettings['json'])) { $file = MaskUtility::getFileAbsFileName($this->extSettings['json']); if (file_exists($file)) { - self::$json = json_decode(file_get_contents($file), true, 512, JSON_THROW_ON_ERROR); + self::$json = json_decode(file_get_contents($file), true, 512, 4194304); } } } @@ -113,7 +113,7 @@ public function write($json): void $file = MaskUtility::getFileAbsFileName($this->extSettings['json']); GeneralUtility::writeFile( $file, - json_encode($json, JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT, 512) + json_encode($json, 4194304 | JSON_PRETTY_PRINT, 512) ); } self::$json = $json; diff --git a/Classes/ItemsProcFuncs/CTypeList.php b/Classes/ItemsProcFuncs/CTypeList.php index bb042d69..a6a8c36a 100644 --- a/Classes/ItemsProcFuncs/CTypeList.php +++ b/Classes/ItemsProcFuncs/CTypeList.php @@ -59,7 +59,7 @@ public function itemsProcFunc(&$params): void $fieldKey = ''; if (isset($_REQUEST['ajax']['context'])) { - $ajaxContext = json_decode($_REQUEST['ajax']['context'], true, 512, JSON_THROW_ON_ERROR); + $ajaxContext = json_decode($_REQUEST['ajax']['context'], true, 512, 4194304); $fieldKey = str_replace('_parent', '', $ajaxContext->config->foreign_field); } else { $fields = $params['row']; From 30910c6502467d4e0dee93cd1edd2bff9e2eea05 Mon Sep 17 00:00:00 2001 From: Johannes Date: Mon, 27 Apr 2020 16:41:48 +0200 Subject: [PATCH 90/93] Require TYPO3 10 release version --- composer.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index ae03162f..396e7ea1 100644 --- a/composer.json +++ b/composer.json @@ -26,10 +26,10 @@ "require": { "php": "^7.2", "ext-json": "*", - "typo3/cms-core": "10.3.*@dev || dev-master", - "typo3/cms-backend": "10.3.*@dev || dev-master", - "typo3/cms-fluid": "10.3.*@dev || dev-master", - "typo3/cms-extbase": "10.3.*@dev || dev-master" + "typo3/cms-core": "^10.4", + "typo3/cms-backend": "^10.4", + "typo3/cms-fluid": "^10.4", + "typo3/cms-extbase": "^10.4" }, "replace": { "typo3-ter/mask": "self.version" From de702796856b94d0cb64fc88fd9b6cc7bcce261b Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Tue, 28 Apr 2020 15:15:12 +0200 Subject: [PATCH 91/93] [FEATURE] add the possibility to set the mask preview image path with EXT: path --- .../IconProvider/ContentElementIconProvider.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Classes/Imaging/IconProvider/ContentElementIconProvider.php b/Classes/Imaging/IconProvider/ContentElementIconProvider.php index 9d9b841a..c4edbdef 100644 --- a/Classes/Imaging/IconProvider/ContentElementIconProvider.php +++ b/Classes/Imaging/IconProvider/ContentElementIconProvider.php @@ -6,6 +6,7 @@ use InvalidArgumentException; use MASK\Mask\Domain\Repository\StorageRepository; use MASK\Mask\Domain\Service\SettingsService; +use MASK\Mask\Utility\GeneralUtility as MaskUtility; use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationExtensionNotConfiguredException; use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationPathDoesNotExistException; use TYPO3\CMS\Core\Core\Environment; @@ -113,7 +114,7 @@ protected function generateMarkup(Icon $icon, array $options): string $fontAwesomeKeyAvailable = $this->isFontAwesomeKeyAvailable($this->contentElement); // decide what kind of icon to render - if ($fontAwesomeKeyAvailable) { + if ($fontAwesomeKeyAvailable && !$previewIconAvailable) { $color = $this->getColor($this->contentElement); $styles = []; @@ -129,8 +130,8 @@ protected function generateMarkup(Icon $icon, array $options): string } } else { if ($previewIconAvailable) { - $markup = '' . $this->contentElement['label'] . ''; + $markup = '' . $this->contentElement['label'] . ''; } else { $color = $this->getColor($this->contentElement); if ($color) { @@ -152,10 +153,7 @@ protected function generateMarkup(Icon $icon, array $options): string */ protected function isPreviewIconAvailable($key): bool { - if (file_exists(Environment::getPublicPath() . $this->getPreviewIconPath($key))) { - return true; - } - return false; + return file_exists($this->getPreviewIconPath($key)); } /** @@ -175,7 +173,9 @@ protected function isFontAwesomeKeyAvailable($element): bool */ protected function getPreviewIconPath($key): string { - return $this->extSettings['preview'] . $key . '.png'; + return MaskUtility::getFileAbsFileName( + rtrim($this->extSettings['preview'], '/') . '/' + ) . $key . '.png'; } /** From e1a1df01f3e1c7a28e41cedfa4598c0527371bd5 Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Tue, 28 Apr 2020 15:51:57 +0200 Subject: [PATCH 92/93] [TASK] add changelog for mask 5.0.0 --- CHANGELOG.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e8f98343..d6c1775b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,29 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [5.0.0] - 2020-04-28 + +### Added +- Support for TYPO3 v10. Thank you [Jürgen Venne](https://github.com/juergen-venne) + +### Changed +- basic code cleanup and minor refactoring +- complete redesign of Mask backend module +- hidden IRRE elements are now visible in the backend[#262](https://github.com/Gernott/mask/pull/262) +- declared strict_types in all classes for better code quality +- replaced deprecated composer option "replace" with extra/extension-key +- moved the mask backend module to the bottom of the admin tools + +### Removed +- Support for TYPO3 v9 LTS was dropped. Use Mask v4.x.x for TYPO3 v9 LTS + +### Fixed +- Sort inline fields recursively to output correct order of fields in editor [#267](https://github.com/Gernott/mask/pull/267) +- Added softref-config to rte fields [#266](https://github.com/Gernott/mask/pull/266) +- Fixed TCA default value of field parentid for Inline-Tables [#249](https://github.com/Gernott/mask/pull/249) +- Fixed the path resolution in backend preview images + + ## [4.1.2] - 2019-08-27 ### Changed From e84456bb342a388720930a899952f33edec294dd Mon Sep 17 00:00:00 2001 From: Benjamin Butschell Date: Tue, 28 Apr 2020 15:54:03 +0200 Subject: [PATCH 93/93] [TASK] adjusting changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d6c1775b..796d79e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [5.0.0] - 2020-04-28 ### Added -- Support for TYPO3 v10. Thank you [Jürgen Venne](https://github.com/juergen-venne) +- Support for TYPO3 v10. Thank you [Jürgen Venne](https://github.com/juergen-venne) and all the sponsors! ### Changed - basic code cleanup and minor refactoring

              - Neues Inhaltselement anlegen +