From 4c926b29966fd8a0f68a7feb60541039be016670 Mon Sep 17 00:00:00 2001 From: zonky2 Date: Mon, 30 Aug 2021 07:06:44 +0200 Subject: [PATCH 01/59] Update require symfony Update require symfony --- composer.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 337b509..682416a 100644 --- a/composer.json +++ b/composer.json @@ -56,13 +56,13 @@ "require": { "php": "^5.6 || ^7.0 || ^8.0", "contao/core-bundle": "^4.9", - "symfony/config": "^4.4 || ^5.1", - "symfony/console": "^4.4 || ^5.1", - "symfony/dependency-injection": "^4.4 || ^5.1", - "symfony/event-dispatcher": "^4.4 || ^5.1", - "symfony/http-foundation": "^4.4 || ^5.1", - "symfony/http-kernel": "^4.4 || ^5.1", - "symfony/translation": "^4.4 || ^5.1" + "symfony/config": "^4.4 || ^5.2", + "symfony/console": "^4.4 || ^5.2", + "symfony/dependency-injection": "^4.4 || ^5.2", + "symfony/event-dispatcher": "^4.4 || ^5.2", + "symfony/http-foundation": "^4.4 || ^5.2", + "symfony/http-kernel": "^4.4 || ^5.2", + "symfony/translation": "^4.4 || ^5.2" }, "require-dev": { "phpcq/all-tasks": "~1.2", From 38e9843a5d7d15b1e0b5c585c8a0f6ce66a58283 Mon Sep 17 00:00:00 2001 From: David Greminger Date: Tue, 19 Oct 2021 10:57:36 +0200 Subject: [PATCH 02/59] Add PHP8 array isset checks --- src/Contao/Widgets/MultiColumnWizard.php | 46 ++++++++++++------------ 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/Contao/Widgets/MultiColumnWizard.php b/src/Contao/Widgets/MultiColumnWizard.php index 3e02ab6..b7adcee 100644 --- a/src/Contao/Widgets/MultiColumnWizard.php +++ b/src/Contao/Widgets/MultiColumnWizard.php @@ -358,7 +358,7 @@ public static function generateSimpleMcw($table, $field) public function generateLabel() { foreach ($this->columnFields as $arrField) { - if ($arrField['eval']['mandatory']) { + if (isset($arrField['eval']['mandatory']) && $arrField['eval']['mandatory']) { $this->addAttribute('mandatory', true); break; } @@ -421,7 +421,7 @@ protected function getMcWDatePickerString( $tableName = null ) { // Datepicker - if (!$fieldConfiguration['eval']['datepicker'] || !isset($fieldConfiguration['eval']['rgxp'])) { + if ((isset($fieldConfiguration['eval']['datepicker']) && !$fieldConfiguration['eval']['datepicker']) || !isset($fieldConfiguration['eval']['rgxp'])) { return ''; } @@ -720,22 +720,22 @@ public function generate($overwriteRowCurrentRow = null, $onlyRows = false) foreach ($this->columnFields as $strKey => $arrField) { // Store unique fields - if ($arrField['eval']['unique']) { + if (isset($arrField['eval']['unique']) && $arrField['eval']['unique']) { $arrUnique[] = $strKey; } // Store date picker fields - if ($arrField['eval']['datepicker']) { + if (isset ($arrField['eval']['datepicker']) && $arrField['eval']['datepicker']) { $arrDatepicker[] = $strKey; } // Store color picker fields - if ($arrField['eval']['colorpicker']) { + if (isset($arrField['eval']['colorpicker']) && $arrField['eval']['colorpicker']) { $arrColorpicker[] = $strKey; } // Store tiny mce fields - if ($arrField['eval']['rte'] && strncmp($arrField['eval']['rte'], 'tiny', 4) === 0) { + if (isset($arrField['eval']['rte']) && $arrField['eval']['rte'] && strncmp($arrField['eval']['rte'], 'tiny', 4) === 0) { foreach ($this->varValue as $row => $value) { $tinyId = 'ctrl_' . $this->strField . '_row' . $row . '_' . $strKey; @@ -781,7 +781,7 @@ public function generate($overwriteRowCurrentRow = null, $onlyRows = false) $strWidget = ''; $blnHiddenBody = false; - if ($arrField['eval']['hideHead'] == true) { + if (isset($arrField['eval']['hideHead']) && $arrField['eval']['hideHead'] == true) { $arrHiddenHeader[$strKey] = true; } @@ -832,7 +832,7 @@ public function generate($overwriteRowCurrentRow = null, $onlyRows = false) } elseif ($arrField['inputType'] == 'hidden') { $strHidden .= $objWidget->generate(); continue; - } elseif ($arrField['eval']['hideBody'] == true || $arrField['eval']['hideHead'] == true) { + } elseif ((isset($arrField['eval']['hideBody']) && $arrField['eval']['hideBody'] == true) || (isset($arrField['eval']['hideHead']) && $arrField['eval']['hideHead'] == true)) { if ($arrField['eval']['hideBody'] == true) { $blnHiddenBody = true; } @@ -859,7 +859,7 @@ public function generate($overwriteRowCurrentRow = null, $onlyRows = false) ); // Tiny MCE. - if ($arrField['eval']['rte'] && strncmp($arrField['eval']['rte'], 'tiny', 4) === 0) { + if (isset($arrField['eval']['rte']) && $arrField['eval']['rte'] && strncmp($arrField['eval']['rte'], 'tiny', 4) === 0) { $additionalCode['tinyMce'] = $this->getMcWTinyMCEString( $objWidget->id, $arrField, @@ -906,7 +906,7 @@ function ($value) { } // Build array of items - if ($arrField['eval']['columnPos'] != '') { + if (isset($arrField['eval']['columnPos']) && $arrField['eval']['columnPos'] != '') { $arrItems[$i][$objWidget->columnPos]['entry'] .= $strWidget; $arrItems[$i][$objWidget->columnPos]['valign'] = $arrField['eval']['valign']; $arrItems[$i][$objWidget->columnPos]['tl_class'] = $arrField['eval']['tl_class']; @@ -915,7 +915,7 @@ function ($value) { $arrItems[$i][$strKey] = array ( 'entry' => $strWidget, - 'valign' => $arrField['eval']['valign'], + 'valign' => $arrField['eval']['valign'] ?? null, 'tl_class' => $arrField['eval']['tl_class'], 'hide' => $blnHiddenBody ); @@ -1009,7 +1009,7 @@ protected function initializeWidget(&$arrField, $intRow, $strKey, $varValue) } // Add the help wizard - if ($arrField['eval']['helpwizard']) { + if (isset($arrField['eval']['helpwizard']) && $arrField['eval']['helpwizard']) { $xlabel .= ' import($callback[0]); $varValue = $this->{$callback[0]}->{$callback[1]}($varValue, $this); } - } elseif (is_callable($arrField['load_callback'])) { + } elseif (isset($arrField['load_callback']) && is_callable($arrField['load_callback'])) { $varValue = $arrField['load_callback']($varValue, $this); } // Convert date formats into timestamps (check the eval setting first -> #3063) - $rgxp = $arrField['eval']['rgxp']; + $rgxp = $arrField['eval']['rgxp'] ?? null; $dateFormatErrorMsg = ''; if (($rgxp == 'date' || $rgxp == 'time' || $rgxp == 'datim') && $varValue != '') { try { @@ -1171,7 +1171,7 @@ protected function initializeWidget(&$arrField, $intRow, $strKey, $varValue) $arrField['activeRow'] = $intRow; $arrField['name'] = $this->strName . '[' . $intRow . '][' . $strKey . ']'; $arrField['id'] = $this->strId . '_row' . $intRow . '_' . $strKey; - $arrField['value'] = (null !== $varValue) ? $varValue : $arrField['default']; + $arrField['value'] = (null !== $varValue) ? $varValue : $arrField['default'] ?? null; $arrField['eval']['tableless'] = true; $arrData = $this->handleDcGeneral($arrField, $strKey); @@ -1211,7 +1211,7 @@ private function buildWidget($strClass, array $arrData, array &$arrField) $arrData, $arrField['name'], $arrField['value'], - $arrField['strField'], + $arrField['strField'] ?? null, $this->strTable, $this )); @@ -1387,10 +1387,10 @@ protected function generateTable( // Generate header fields if not all are hidden. if (count($this->columnFields) !== count($arrHiddenHeader)) { foreach ($this->columnFields as $strKey => $arrField) { - if ($arrField['eval']['columnPos']) { + if (isset($arrField['eval']['columnPos']) && $arrField['eval']['columnPos']) { $arrHeaderItems[$arrField['eval']['columnPos']] = ''; } else { - if ((true === $arrField['eval']['hideBody']) && (true === $arrField['eval']['hideHead'])) { + if ((isset($arrField['eval']['hideBody']) && true === $arrField['eval']['hideBody']) && (isset($arrField['eval']['hideHead']) && true === $arrField['eval']['hideHead'])) { $strHeaderItem = (array_key_exists($strKey, $arrHiddenHeader)) ? '' : ''; From 14d0fd7c0384809bedcd5c552670186f8e9e68a1 Mon Sep 17 00:00:00 2001 From: David Greminger Date: Tue, 19 Oct 2021 11:26:32 +0200 Subject: [PATCH 03/59] More fixes --- composer.json | 2 +- src/Contao/Widgets/MultiColumnWizard.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 337b509..29a580b 100644 --- a/composer.json +++ b/composer.json @@ -54,7 +54,7 @@ "source": "https://github.com/menatwork/MultiColumnWizard" }, "require": { - "php": "^5.6 || ^7.0 || ^8.0", + "php": "^7.0 || ^8.0", "contao/core-bundle": "^4.9", "symfony/config": "^4.4 || ^5.1", "symfony/console": "^4.4 || ^5.1", diff --git a/src/Contao/Widgets/MultiColumnWizard.php b/src/Contao/Widgets/MultiColumnWizard.php index b7adcee..42c49f3 100644 --- a/src/Contao/Widgets/MultiColumnWizard.php +++ b/src/Contao/Widgets/MultiColumnWizard.php @@ -608,7 +608,7 @@ protected function validator($varInput) $varValue = $objWidget->value; // Convert date formats into timestamps (check the eval setting first -> #3063) - $rgxp = $arrField['eval']['rgxp']; + $rgxp = $arrField['eval']['rgxp'] ?? ''; if (!$objWidget->hasErrors() && ($rgxp == 'date' || $rgxp == 'time' || $rgxp == 'datim') && $varValue != '' @@ -618,7 +618,7 @@ protected function validator($varInput) } // Save callback - if (is_array($arrField['save_callback'])) { + if (isset($arrField['save_callback']) && is_array($arrField['save_callback'])) { foreach ($arrField['save_callback'] as $callback) { $this->import($callback[0]); @@ -1150,7 +1150,7 @@ protected function initializeWidget(&$arrField, $intRow, $strKey, $varValue) } // Convert date formats into timestamps (check the eval setting first -> #3063) - $rgxp = $arrField['eval']['rgxp'] ?? null; + $rgxp = $arrField['eval']['rgxp'] ?? ''; $dateFormatErrorMsg = ''; if (($rgxp == 'date' || $rgxp == 'time' || $rgxp == 'datim') && $varValue != '') { try { From fe57d73dd56e9a5d9d7fa8845b17ae37d5a9e74a Mon Sep 17 00:00:00 2001 From: David Greminger Date: Thu, 3 Feb 2022 16:47:42 +0100 Subject: [PATCH 04/59] Add more isset() checks --- src/Contao/Widgets/MultiColumnWizard.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Contao/Widgets/MultiColumnWizard.php b/src/Contao/Widgets/MultiColumnWizard.php index 42c49f3..de8ddb1 100644 --- a/src/Contao/Widgets/MultiColumnWizard.php +++ b/src/Contao/Widgets/MultiColumnWizard.php @@ -1112,7 +1112,7 @@ protected function initializeWidget(&$arrField, $intRow, $strKey, $varValue) $arrField['eval']['required'] = false; // Use strlen() here (see #3277) - if ($arrField['eval']['mandatory']) { + if (isset($arrField['eval']['mandatory']) && $arrField['eval']['mandatory']) { if (is_array($this->varValue[$intRow][$strKey])) { if (empty($this->varValue[$intRow][$strKey])) { $arrField['eval']['required'] = true; @@ -1398,7 +1398,7 @@ protected function generateTable( $strHeaderItem = '' . (array_key_exists($strKey, $arrHiddenHeader) ? '' : ''; - $arrHeaderItems[] = $strHeaderItem . ''; + ); + $strHeaderItem .= (array_key_exists($strKey, $arrHiddenHeader)) ? '' : ''; + $arrHeaderItems[] = $strHeaderItem . ''; } } } From 3bbbb6b614ece9a1d084a1a2405228b37f5482c8 Mon Sep 17 00:00:00 2001 From: Ingolf Steinhardt Date: Fri, 1 Jul 2022 17:16:03 +0200 Subject: [PATCH 25/59] Fix PHP 8 Warnings --- src/Contao/Widgets/MultiColumnWizard.php | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/Contao/Widgets/MultiColumnWizard.php b/src/Contao/Widgets/MultiColumnWizard.php index 0e9f02c..3e2f742 100644 --- a/src/Contao/Widgets/MultiColumnWizard.php +++ b/src/Contao/Widgets/MultiColumnWizard.php @@ -1142,21 +1142,6 @@ protected function initializeWidget(&$arrField, $intRow, $strKey, $varValue) return null; } - $arrField['eval']['required'] = false; - - // Use strlen() here (see #3277) - if (isset($arrField['eval']['mandatory']) && $arrField['eval']['mandatory']) { - if (is_array($this->varValue[$intRow][$strKey])) { - if (empty($this->varValue[$intRow][$strKey])) { - $arrField['eval']['required'] = true; - } - } else { - if (!strlen($this->varValue[$intRow][$strKey])) { - $arrField['eval']['required'] = true; - } - } - } - // Hide label except if multiple widgets are in one column if (!isset($arrField['eval']['columnPos']) || empty($arrField['eval']['columnPos'])) { $arrField['eval']['tl_class'] = trim(($arrField['eval']['tl_class'] ?? '') . ' hidelabel'); @@ -1493,7 +1478,7 @@ protected function generateTable( $this->strId ); - if ($this->columnTemplate == '' && is_array($arrHeaderItems)) { + if ($this->columnTemplate == '' && isset($arrHeaderItems) && is_array($arrHeaderItems)) { $return .= \sprintf('%s', implode("\n ", $arrHeaderItems)); } From 431ac2107cbd3a8da3dbc41e861cdf678a41d4ae Mon Sep 17 00:00:00 2001 From: Kamil Kuzminski Date: Tue, 5 Jul 2022 09:53:50 +0200 Subject: [PATCH 26/59] Fix PHP 8 warnings --- src/Contao/Widgets/MultiColumnWizard.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Contao/Widgets/MultiColumnWizard.php b/src/Contao/Widgets/MultiColumnWizard.php index 3e2f742..8778bf8 100644 --- a/src/Contao/Widgets/MultiColumnWizard.php +++ b/src/Contao/Widgets/MultiColumnWizard.php @@ -609,7 +609,7 @@ protected function validator($varInput) // Walk every column foreach ($this->columnFields as $strKey => $arrField) { - $objWidget = $this->initializeWidget($arrField, $i, $strKey, $varInput[$i][$strKey]); + $objWidget = $this->initializeWidget($arrField, $i, $strKey, $varInput[$i][$strKey] ?? null); // can be null on error, or a string on input_field_callback if (!is_object($objWidget)) { From 20a7c2f7be8aee246ae64fe0041ef5743cdb7295 Mon Sep 17 00:00:00 2001 From: zonky2 Date: Fri, 22 Jul 2022 12:50:46 +0200 Subject: [PATCH 27/59] add move => false --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b5625c6..ab89e9e 100644 --- a/README.md +++ b/README.md @@ -129,7 +129,8 @@ $GLOBALS['TL_DCA']['tl_theme']['fields']['templateSelection'] = [ 'copy' => false, 'delete' => false, 'up' => false, - 'down' => false + 'down' => false, + 'move' => false ], // as alternative to hide all buttons use the next line //'hideButtons' => true, From 41186c54f69f45f187ab3f5b44f6f28199d16478 Mon Sep 17 00:00:00 2001 From: ameotoko Date: Fri, 22 Jul 2022 21:50:28 +0200 Subject: [PATCH 28/59] fix Undefined array key "inputType" --- src/Contao/Widgets/MultiColumnWizard.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/Contao/Widgets/MultiColumnWizard.php b/src/Contao/Widgets/MultiColumnWizard.php index 0e9f02c..aed01f2 100644 --- a/src/Contao/Widgets/MultiColumnWizard.php +++ b/src/Contao/Widgets/MultiColumnWizard.php @@ -772,10 +772,6 @@ public function generate($overwriteRowCurrentRow = null, $onlyRows = false) $arrTinyMCE[] = $strKey; } - - if ($arrField['inputType'] == 'hidden') { - continue; - } } $intNumberOfRows = max(count($this->varValue), 1); @@ -1025,7 +1021,7 @@ protected function initializeWidget(&$arrField, $intRow, $strKey, $varValue) $arrField['activeRecord'] = $this->activeRecord; // Toggle line wrap (textarea) - if ($arrField['inputType'] == 'textarea' && $arrField['eval']['rte'] == '') { + if (($arrField['inputType'] ?? null) == 'textarea' && $arrField['eval']['rte'] == '') { $xlabel .= ' ' . Image::getHtml( 'wrap.gif', @@ -1060,7 +1056,7 @@ protected function initializeWidget(&$arrField, $intRow, $strKey, $varValue) } // Add the popup file manager - if ($arrField['inputType'] == 'fileTree' || $arrField['inputType'] == 'pageTree') { + if (($arrField['inputType'] ?? null) == 'fileTree' || ($arrField['inputType'] ?? null) == 'pageTree') { $path = ''; if (isset($arrField['eval']['path'])) { @@ -1082,7 +1078,7 @@ protected function initializeWidget(&$arrField, $intRow, $strKey, $varValue) // Add title at modal window. $GLOBALS['TL_DCA'][$this->strTable]['fields'][$arrField['strField']]['label'][0] = (is_array($arrField['label']) && $arrField['label'][0] != '') ? $arrField['label'][0] : $strKey; - } elseif ($arrField['inputType'] == 'tableWizard') { + } elseif (($arrField['inputType'] ?? null) == 'tableWizard') { // Add the table import wizard $xlabel .= ' addToUrl('key=list') From ec2a20077961865279a146dfcfea16e85b97e2f9 Mon Sep 17 00:00:00 2001 From: ameotoko Date: Thu, 28 Jul 2022 21:24:40 +0200 Subject: [PATCH 29/59] fix warning --- src/Contao/Widgets/MultiColumnWizard.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Contao/Widgets/MultiColumnWizard.php b/src/Contao/Widgets/MultiColumnWizard.php index 0e9f02c..a2e5830 100644 --- a/src/Contao/Widgets/MultiColumnWizard.php +++ b/src/Contao/Widgets/MultiColumnWizard.php @@ -940,9 +940,9 @@ function ($value) { // Build array of items if (isset($arrField['eval']['columnPos']) && $arrField['eval']['columnPos'] != '') { - $arrItems[$i][$objWidget->columnPos]['entry'] .= $strWidget; - $arrItems[$i][$objWidget->columnPos]['valign'] = $arrField['eval']['valign']; - $arrItems[$i][$objWidget->columnPos]['tl_class'] = $arrField['eval']['tl_class']; + $arrItems[$i][$objWidget->columnPos]['entry'] = ($arrItems[$i][$objWidget->columnPos]['entry'] ?? '') . $strWidget; + $arrItems[$i][$objWidget->columnPos]['valign'] = ($arrField['eval']['valign'] ?? ''); + $arrItems[$i][$objWidget->columnPos]['tl_class'] = ($arrField['eval']['tl_class'] ?? ''); $arrItems[$i][$objWidget->columnPos]['hide'] = $blnHiddenBody; } else { $arrItems[$i][$strKey] = array From 2e338794b87e7f2cb88a02902ddf26d37a8ace55 Mon Sep 17 00:00:00 2001 From: Stefan Heimes Date: Sun, 7 Aug 2022 13:14:48 +0200 Subject: [PATCH 30/59] Revoke some changes --- src/Contao/Widgets/MultiColumnWizard.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Contao/Widgets/MultiColumnWizard.php b/src/Contao/Widgets/MultiColumnWizard.php index 3e2f742..09e3222 100644 --- a/src/Contao/Widgets/MultiColumnWizard.php +++ b/src/Contao/Widgets/MultiColumnWizard.php @@ -1142,6 +1142,21 @@ protected function initializeWidget(&$arrField, $intRow, $strKey, $varValue) return null; } + $arrField['eval']['required'] = false; + + // Use strlen() here (see #3277) + if (isset($arrField['eval']['mandatory']) && $arrField['eval']['mandatory']) { + if (is_array($this->varValue[$intRow][$strKey])) { + if (empty($this->varValue[$intRow][$strKey])) { + $arrField['eval']['required'] = true; + } + } else { + if (!strlen($this->varValue[$intRow][$strKey])) { + $arrField['eval']['required'] = true; + } + } + } + // Hide label except if multiple widgets are in one column if (!isset($arrField['eval']['columnPos']) || empty($arrField['eval']['columnPos'])) { $arrField['eval']['tl_class'] = trim(($arrField['eval']['tl_class'] ?? '') . ' hidelabel'); From 54b1520bc580d8c337edf6ca70af8934ee1a65b5 Mon Sep 17 00:00:00 2001 From: Stefan Heimes Date: Sun, 7 Aug 2022 13:45:07 +0200 Subject: [PATCH 31/59] Correction for the PR #8 Fix the error "Line exceeds 120 characters" --- src/Contao/Widgets/MultiColumnWizard.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Contao/Widgets/MultiColumnWizard.php b/src/Contao/Widgets/MultiColumnWizard.php index 6a8b9bf..4e5884e 100644 --- a/src/Contao/Widgets/MultiColumnWizard.php +++ b/src/Contao/Widgets/MultiColumnWizard.php @@ -936,7 +936,8 @@ function ($value) { // Build array of items if (isset($arrField['eval']['columnPos']) && $arrField['eval']['columnPos'] != '') { - $arrItems[$i][$objWidget->columnPos]['entry'] = ($arrItems[$i][$objWidget->columnPos]['entry'] ?? '') . $strWidget; + $arrItems[$i][$objWidget->columnPos]['entry'] = + ($arrItems[$i][$objWidget->columnPos]['entry'] ?? '') . $strWidget; $arrItems[$i][$objWidget->columnPos]['valign'] = ($arrField['eval']['valign'] ?? ''); $arrItems[$i][$objWidget->columnPos]['tl_class'] = ($arrField['eval']['tl_class'] ?? ''); $arrItems[$i][$objWidget->columnPos]['hide'] = $blnHiddenBody; From b0099c77ee75b3e9a93cff099873dd05687d7679 Mon Sep 17 00:00:00 2001 From: Stefan Heimes Date: Sun, 7 Aug 2022 14:18:07 +0200 Subject: [PATCH 32/59] Correct the required check for the fields. --- src/Contao/Widgets/MultiColumnWizard.php | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/Contao/Widgets/MultiColumnWizard.php b/src/Contao/Widgets/MultiColumnWizard.php index 4e5884e..72601c0 100644 --- a/src/Contao/Widgets/MultiColumnWizard.php +++ b/src/Contao/Widgets/MultiColumnWizard.php @@ -1140,17 +1140,16 @@ protected function initializeWidget(&$arrField, $intRow, $strKey, $varValue) } $arrField['eval']['required'] = false; - - // Use strlen() here (see #3277) - if (isset($arrField['eval']['mandatory']) && $arrField['eval']['mandatory']) { - if (is_array($this->varValue[$intRow][$strKey])) { - if (empty($this->varValue[$intRow][$strKey])) { - $arrField['eval']['required'] = true; - } - } else { - if (!strlen($this->varValue[$intRow][$strKey])) { - $arrField['eval']['required'] = true; - } + if ( + isset($arrField['eval']['mandatory']) + && $arrField['eval']['mandatory'] + && array_key_exists($intRow, $this->varValue) + && array_key_exists($strKey, $this->varValue[$intRow]) + ) { + if (is_array($this->varValue[$intRow][$strKey]) && empty($this->varValue[$intRow][$strKey])) { + $arrField['eval']['required'] = true; + } else if('' === $this->varValue[$intRow][$strKey]){ + $arrField['eval']['required'] = true; } } From e3f93df4c7588837b577a6f6dbbbf44641043e8b Mon Sep 17 00:00:00 2001 From: Stefan Heimes Date: Sun, 7 Aug 2022 14:30:16 +0200 Subject: [PATCH 33/59] Correct code style. --- src/Contao/Widgets/MultiColumnWizard.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Contao/Widgets/MultiColumnWizard.php b/src/Contao/Widgets/MultiColumnWizard.php index 72601c0..1ccb306 100644 --- a/src/Contao/Widgets/MultiColumnWizard.php +++ b/src/Contao/Widgets/MultiColumnWizard.php @@ -1148,7 +1148,7 @@ protected function initializeWidget(&$arrField, $intRow, $strKey, $varValue) ) { if (is_array($this->varValue[$intRow][$strKey]) && empty($this->varValue[$intRow][$strKey])) { $arrField['eval']['required'] = true; - } else if('' === $this->varValue[$intRow][$strKey]){ + } elseif ('' === $this->varValue[$intRow][$strKey]) { $arrField['eval']['required'] = true; } } From 4dd352201f3468150471820fa32aa746431f3aa4 Mon Sep 17 00:00:00 2001 From: Marko Cupic Date: Mon, 15 Aug 2022 11:18:28 +0200 Subject: [PATCH 34/59] Fix undefined array key issue --- src/EventListener/Mcw/DatePicker.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EventListener/Mcw/DatePicker.php b/src/EventListener/Mcw/DatePicker.php index 1ffb396..7dd8aab 100644 --- a/src/EventListener/Mcw/DatePicker.php +++ b/src/EventListener/Mcw/DatePicker.php @@ -69,7 +69,7 @@ public function executeEvent(GetDatePickerStringEvent $event) $strOnSelect = ''; // Trigger the auto-submit function (see #8603) - if ($fieldConfiguration['eval']['submitOnChange']) { + if ($fieldConfiguration['eval']['submitOnChange'] ?? null) { $strOnSelect = ",\n onSelect: function() { Backend.autoSubmit(\"" . $table . '"); }'; } From 94584f11d045fb765f1bd4f8e99d8818879156b1 Mon Sep 17 00:00:00 2001 From: Stefan Heimes Date: Wed, 1 Feb 2023 23:16:22 +0100 Subject: [PATCH 35/59] Update for Contao 5 support --- composer.json | 18 +++++++++--------- .../MultiColumnWizardExtension.php | 2 +- src/MultiColumnWizardBundle.php | 11 ++--------- 3 files changed, 12 insertions(+), 19 deletions(-) diff --git a/composer.json b/composer.json index a2db768..8f1bd56 100644 --- a/composer.json +++ b/composer.json @@ -53,16 +53,16 @@ "source": "https://github.com/menatwork/MultiColumnWizard" }, "require": { - "php": "^7.4 || ^8.0", + "php": "^8.1", "ext-json": "*", - "contao/core-bundle": "^4.9", - "symfony/config": "^4.4 || ^5.2", - "symfony/console": "^4.4 || ^5.2", - "symfony/dependency-injection": "^4.4 || ^5.2", - "symfony/event-dispatcher": "^4.4 || ^5.2", - "symfony/http-foundation": "^4.4 || ^5.2", - "symfony/http-kernel": "^4.4 || ^5.2", - "symfony/translation": "^4.4 || ^5.2" + "contao/core-bundle": "^5.1", + "symfony/config": "^5.4 || ^6.0", + "symfony/console": "^5.4 || ^6.0", + "symfony/dependency-injection": "^5.4 || ^6.0", + "symfony/event-dispatcher": "^5.4 || ^6.0", + "symfony/http-foundation": "^5.4 || ^6.0", + "symfony/http-kernel": "^5.4 || ^6.0", + "symfony/translation": "^5.4 || ^6.0" }, "require-dev": { "contao/manager-plugin": "^2.1", diff --git a/src/DependencyInjection/MultiColumnWizardExtension.php b/src/DependencyInjection/MultiColumnWizardExtension.php index 21b3b03..90413bf 100644 --- a/src/DependencyInjection/MultiColumnWizardExtension.php +++ b/src/DependencyInjection/MultiColumnWizardExtension.php @@ -46,7 +46,7 @@ class MultiColumnWizardExtension extends Extension /** * {@inheritdoc} */ - public function getAlias() + public function getAlias(): string { return 'multicolumnwizard-bundle'; } diff --git a/src/MultiColumnWizardBundle.php b/src/MultiColumnWizardBundle.php index 8d4216e..9a58b5e 100644 --- a/src/MultiColumnWizardBundle.php +++ b/src/MultiColumnWizardBundle.php @@ -24,6 +24,7 @@ use MenAtWork\MultiColumnWizardBundle\DependencyInjection\MultiColumnWizardExtension; use Symfony\Component\Console\Application; +use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; use Symfony\Component\HttpKernel\Bundle\Bundle; /** @@ -39,16 +40,8 @@ class MultiColumnWizardBundle extends Bundle /** * {@inheritdoc} */ - public function getContainerExtension() + public function getContainerExtension(): ?ExtensionInterface { return new MultiColumnWizardExtension(); } - - /** - * {@inheritdoc} - */ - public function registerCommands(Application $application) - { - // disable automatic command registration - } } From 168909dbcfb9e5dbacd9d753364e0de2ce0ccf3d Mon Sep 17 00:00:00 2001 From: Stefan Heimes Date: Sun, 5 Feb 2023 21:30:08 +0100 Subject: [PATCH 36/59] Remove deprecated functions and calls from Contao 4 And replace these with the new functions from Contao 5. --- src/Contao/Widgets/MultiColumnWizard.php | 25 +++-- .../Contao/ExecutePostActions.php | 92 ++++++++++++++----- src/EventListener/Contao/InitializeSystem.php | 41 ++++++++- src/EventListener/Contao/ParseTemplate.php | 32 +++++-- src/EventListener/Mcw/CreateWidget.php | 24 ++++- src/MultiColumnWizardBundle.php | 3 - src/Resources/config/listener.yml | 2 + src/Resources/config/services.yml | 10 ++ src/Resources/contao/config/config.php | 46 +++------- src/Service/ContaoApiService.php | 80 ++++++++++++++++ 10 files changed, 277 insertions(+), 78 deletions(-) create mode 100644 src/Service/ContaoApiService.php diff --git a/src/Contao/Widgets/MultiColumnWizard.php b/src/Contao/Widgets/MultiColumnWizard.php index 1ccb306..e83c33a 100644 --- a/src/Contao/Widgets/MultiColumnWizard.php +++ b/src/Contao/Widgets/MultiColumnWizard.php @@ -52,6 +52,7 @@ namespace MenAtWork\MultiColumnWizardBundle\Contao\Widgets; use Contao\BackendTemplate; +use Contao\Controller; use Contao\DataContainer; use Contao\Date; use Contao\DC_File; @@ -66,6 +67,7 @@ use MenAtWork\MultiColumnWizardBundle\Event\GetOptionsEvent; use MenAtWork\MultiColumnWizardBundle\Event\GetTinyMceStringEvent; use MenAtWork\MultiColumnWizardBundle\Event\GetDcaPickerWizardStringEvent; +use MenAtWork\MultiColumnWizardBundle\Service\ContaoApiService; use Symfony\Component\EventDispatcher\EventDispatcherInterface; /** @@ -159,13 +161,17 @@ class MultiColumnWizard extends Widget 'delete' => 'delete.gif', 'move' => 'drag.gif' ]; + /** + * @var ContaoApiService + */ + private ContaoApiService $contaoApi; /** * Initialize the object * - * @param bool $arrAttributes The attributes for the widget. + * @param array $arrAttributes The attributes for the widget. */ - public function __construct($arrAttributes = false) + public function __construct($arrAttributes = []) { // Ensure we have aliased the deprecated class - circumvent issue #39 but can not trigger deprecation then. :/ if (!class_exists('MultiColumnWizard', false)) { @@ -174,18 +180,19 @@ class_alias(self::class, 'MultiColumnWizard'); parent::__construct($arrAttributes); - if (TL_MODE == 'FE') { + $this->contaoApi = System::getContainer()->get(ContaoApiService::class); + $this->eventDispatcher = System::getContainer()->get('event_dispatcher'); + + // Frontend handling. + if (!empty($arrAttributes['strTable']) && $this->contaoApi->isFrontend()) { $this->strTemplate = 'form_widget'; - $this->loadDataContainer($arrAttributes['strTable']); + Controller::loadDataContainer($arrAttributes['strTable']); } - $this->eventDispatcher = System::getContainer()->get('event_dispatcher'); - /* * Load the callback data if there's any * (do not do this in __set() already because then we don't have access to currentRecord) */ - if (is_array($this->arrCallback)) { $this->import($this->arrCallback[0]); $this->columnFields = $this->{$this->arrCallback[0]}->{$this->arrCallback[1]}($this); @@ -921,7 +928,7 @@ function ($value) { // Contao changed the name for FileTree and PageTree widgets // @see https://github.com/menatwork/contao-multicolumnwizard-bundle/issues/51 - $contaoVersion = VERSION . '.' . BUILD; + $contaoVersion = $this->contaoApi->getContaoVersion(); if ( ( @@ -1133,7 +1140,7 @@ protected function initializeWidget(&$arrField, $intRow, $strKey, $varValue) ->{$arrField['input_field_callback'][1]}($this, $xlabel); } - $strClass = $GLOBALS[(TL_MODE == 'BE' ? 'BE_FFL' : 'TL_FFL')][$arrField['inputType']]; + $strClass = $GLOBALS[($this->contaoApi->isBackend() ? 'BE_FFL' : 'TL_FFL')][$arrField['inputType']]; if ($strClass == '' || !class_exists($strClass)) { return null; diff --git a/src/EventListener/Contao/ExecutePostActions.php b/src/EventListener/Contao/ExecutePostActions.php index f1b406c..8c5b247 100644 --- a/src/EventListener/Contao/ExecutePostActions.php +++ b/src/EventListener/Contao/ExecutePostActions.php @@ -25,6 +25,7 @@ namespace MenAtWork\MultiColumnWizardBundle\EventListener\Contao; +use Contao\CoreBundle\Monolog\ContaoContext; use ContaoCommunityAlliance\DcGeneral\ContaoFrontend\View\WidgetManager; use ContaoCommunityAlliance\DcGeneral\Contao\Compatibility\DcCompat; use ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\ContaoWidgetManager; @@ -44,9 +45,12 @@ use Contao\StringUtil; use Contao\System; use Contao\Widget; +use Doctrine\ORM\Mapping as ORM; use MenAtWork\MultiColumnWizardBundle\Contao\Widgets\MultiColumnWizard; use MenAtWork\MultiColumnWizardBundle\EventListener\BaseListener; use MenAtWork\MultiColumnWizardBundle\Event\CreateWidgetEvent; +use MenAtWork\MultiColumnWizardBundle\Service\ContaoApiService; +use Monolog\Logger; use Psr\Log\LogLevel; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; @@ -61,18 +65,37 @@ class ExecutePostActions extends BaseListener * * @var EventDispatcherInterface */ - private $eventDispatcher; + private EventDispatcherInterface $eventDispatcher; + + /** + * @var ContaoApiService + */ + private ContaoApiService $contaoApi; + + /** + * @var Logger + */ + private Logger $logger; /** * ExecutePostActions constructor. * * @param EventDispatcherInterface $eventDispatcher The event dispatcher. + * + * @param ContaoApiService $contaoApi Bridge to Contao. Replacement for the deprecated functions. + * + * @param Logger $logger Logging ;). */ - public function __construct(EventDispatcherInterface $eventDispatcher) - { + public function __construct( + EventDispatcherInterface $eventDispatcher, + ContaoApiService $contaoApi, + Logger $logger + ) { parent::__construct(); + $this->contaoApi = $contaoApi; $this->eventDispatcher = $eventDispatcher; + $this->logger = $logger; } /** @@ -107,25 +130,34 @@ public function handleRowCreation($action, $container) // Create a new event and dispatch it. Hope that someone have a good solution. $event = new CreateWidgetEvent($container); $this->eventDispatcher->dispatch($event, $event::NAME); - /** @var \Widget $widget */ $widget = $event->getWidget(); // Check the instance. if (!($widget instanceof MultiColumnWizard)) { - System::log( + $this->logger->log( + LogLevel::ERROR, 'Field "' . $fieldName . '" is not a mcw in "' . $container->table . '"', - __METHOD__, - 'error' + [ + 'contao' => new ContaoContext( + __CLASS__ . '::' . __FUNCTION__, + 'MCW Execute Post Action' + ) + ] ); throw new BadRequestHttpException('Bad request'); } // The field does not exist if (empty($widget)) { - System::log( + $this->logger->log( + LogLevel::ERROR, 'Field "' . $fieldName . '" does not exist in definition "' . $container->table . '"', - __METHOD__, - 'error' + [ + 'contao' => new ContaoContext( + __CLASS__ . '::' . __FUNCTION__, + 'MCW Execute Post Action' + ) + ] ); throw new BadRequestHttpException('Bad request'); } @@ -169,8 +201,8 @@ public function executePostActions($action, DataContainer $container) $strField = $this->getInputName($container); // Contao changed the name for FileTree and PageTree widgets // @see https://github.com/menatwork/contao-multicolumnwizard-bundle/issues/51 - $contaoVersion = VERSION . '.' . BUILD; - $vNameCheck = ( + $contaoVersion = $this->contaoApi->getContaoVersion(); + $vNameCheck = ( version_compare($contaoVersion, '4.4.41', '>=') && version_compare($contaoVersion, '4.5.0', '<') ) || version_compare($contaoVersion, '4.7.7', '>='); @@ -230,10 +262,15 @@ public function executePostActions($action, DataContainer $container) !(isset($GLOBALS['TL_DCA'][$container->table]['fields'][$strField])) && !($container instanceof DataContainerInterface) ) { - System::log( + $this->logger->log( + LogLevel::ERROR, 'Field "' . $strField . '" does not exist in DCA "' . $container->table . '"', - __METHOD__, - 'error' + [ + 'contao' => new ContaoContext( + __CLASS__ . '::' . __FUNCTION__, + 'MCW Execute Post Action' + ) + ] ); throw new BadRequestHttpException('Bad request'); } @@ -252,10 +289,15 @@ public function executePostActions($action, DataContainer $container) // The record does not exist if ($objRow->numRows < 1) { - System::log( + $this->logger->log( + LogLevel::ERROR, 'A record with the ID "' . $intId . '" does not exist in table "' . $container->table . '"', - __METHOD__, - 'error' + [ + 'contao' => new ContaoContext( + __CLASS__ . '::' . __FUNCTION__, + 'MCW Execute Post Action' + ) + ] ); throw new BadRequestHttpException('Bad request'); } @@ -329,6 +371,7 @@ private function getInputName(DataContainer $container): string $inputName = Input::post('name'); if (!($container instanceof DataContainerInterface)) { $container->inputName = $inputName; + return $inputName; } @@ -360,14 +403,19 @@ private function addDcGeneralProperty(DcCompat $container): void $replace = array('__', ''); $propertyName = \trim(\preg_replace($search, $replace, $container->getPropertyName()), '__'); if (!$properties->hasProperty($propertyName)) { - System::log( + $this->logger->log( + LogLevel::ERROR, \sprintf( 'The property "%s" does not exist in the property definition of "%s"', $container->getPropertyName(), $definition->getName() ), - __METHOD__, - 'error' + [ + 'contao' => new ContaoContext( + __CLASS__ . '::' . __FUNCTION__, + 'MCW Execute Post Action' + ) + ] ); throw new BadRequestHttpException('Bad request'); } @@ -444,7 +492,7 @@ private function buildWidgetForDcg(DataContainerInterface $container, $value): W $model->setId('mcw_' . $container->getPropertyName()); $model->setProperty($property->getName(), $value); - if (TL_MODE === 'FE') { + if ($this->contaoApi->isFrontend()) { $manager = new WidgetManager($environment, $model); } else { $manager = new ContaoWidgetManager($environment, $model); diff --git a/src/EventListener/Contao/InitializeSystem.php b/src/EventListener/Contao/InitializeSystem.php index 87507a2..887e975 100644 --- a/src/EventListener/Contao/InitializeSystem.php +++ b/src/EventListener/Contao/InitializeSystem.php @@ -24,12 +24,51 @@ use Contao\Environment; use Contao\Input; +use Contao\System; +use MenAtWork\MultiColumnWizardBundle\Service\ContaoApiService; /** * Class InitializeSystem */ class InitializeSystem { + /** + * @var ContaoApiService + */ + private ContaoApiService $contaoApi; + + /** + * @param ContaoApiService $contaoApi + */ + public function __construct(ContaoApiService $contaoApi) + { + $this->contaoApi = $contaoApi; + } + + /** + * Check the scope and add some more information. + * + * @return void + */ + public function addSystemNecessaryThings(): void + { + if (!$this->contaoApi->isBackend()) { + return; + } + + $GLOBALS['TL_HOOKS']['parseTemplate'][] = [ParseTemplate::class, 'addVersion']; + + // Add the JS. + $GLOBALS['TL_JAVASCRIPT']['multicolumnwizard'] = $GLOBALS['TL_CONFIG']['debugMode'] + ? 'bundles/multicolumnwizard/js/multicolumnwizard_be_src.js' + : 'bundles/multicolumnwizard/js/multicolumnwizard_be.js'; + + // Add the css. + $GLOBALS['TL_CSS']['multicolumnwizard'] = $GLOBALS['TL_CONFIG']['debugMode'] + ? 'bundles/multicolumnwizard/css/multicolumnwizard_src.css' + : 'bundles/multicolumnwizard/css/multicolumnwizard.css'; + } + /** * The MCW use some strange construction from point of contao. * Contao will rewrite the [rowId][fieldname]. This will cause a problem in the validate function @@ -38,7 +77,7 @@ class InitializeSystem * * @return void */ - public function changeAjaxPostActions() + public function changeAjaxPostActions(): void { if (!Environment::get('isAjaxRequest')) { return; diff --git a/src/EventListener/Contao/ParseTemplate.php b/src/EventListener/Contao/ParseTemplate.php index 61c20aa..54a6cc5 100644 --- a/src/EventListener/Contao/ParseTemplate.php +++ b/src/EventListener/Contao/ParseTemplate.php @@ -22,13 +22,25 @@ namespace MenAtWork\MultiColumnWizardBundle\EventListener\Contao; +use Contao\System; use Contao\Template; +use MenAtWork\MultiColumnWizardBundle\Service\ContaoApiService; /** * Class ParseTemplate */ class ParseTemplate { + /** + * @var ContaoApiService + */ + private ContaoApiService $contaoApi; + + public function __construct() + { + $this->contaoApi = System::getContainer()->get(ContaoApiService::class); + } + /** * Add the scripts and stylesheet to the passed template. * @@ -39,15 +51,19 @@ class ParseTemplate * @@SuppressWarnings(PHPMD.Superglobals) * @SuppressWarnings(PHPMD.CamelCaseVariableName) */ - public function addVersion(&$objTemplate) + public function addVersion(Template &$objTemplate): void { - // do not allow version information to be leaked in the backend login and install tool (#184) - if ($objTemplate->getName() != 'be_login' && $objTemplate->getName() != 'be_install') { - $objTemplate->ua .= ' version_' . str_replace('.', '-', VERSION) . '-' . str_replace( - '.', - '-', - BUILD - ); + // Do not allow version information to be leaked in the backend login and install tool (#184) + if ('be_login' === $objTemplate->getName() || 'be_install' === $objTemplate->getName()) { + return; + } + + // Only run for the backend. I don't know if we need this information in the FE as well. + // ToDo: Check if we need this in FE, if so we should add this information other, 'cause of security. + if (!$this->contaoApi->isBackend()) { + return; } + + $objTemplate->ua .= ' version_' . str_replace('.', '-', $this->contaoApi->getContaoVersion()); } } diff --git a/src/EventListener/Mcw/CreateWidget.php b/src/EventListener/Mcw/CreateWidget.php index 03af19e..766f939 100644 --- a/src/EventListener/Mcw/CreateWidget.php +++ b/src/EventListener/Mcw/CreateWidget.php @@ -23,12 +23,14 @@ namespace MenAtWork\MultiColumnWizardBundle\EventListener\Mcw; +use Contao\CoreBundle\Monolog\ContaoContext; use Contao\Input; use Contao\System; use ContaoCommunityAlliance\DcGeneral\Contao\Compatibility\DcCompat; use ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\ContaoWidgetManager; use MenAtWork\MultiColumnWizardBundle\Contao\Widgets\MultiColumnWizard; use MenAtWork\MultiColumnWizardBundle\Event\CreateWidgetEvent; +use Monolog\Logger; use Psr\Log\LogLevel; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; @@ -37,6 +39,16 @@ */ class CreateWidget { + /** + * @var Logger + */ + private Logger $logger; + + public function __construct(Logger $logger) + { + $this->logger = $logger; + } + /** * Create a widget for Contao context. * @@ -68,10 +80,15 @@ public function createWidgetContao(CreateWidgetEvent $event) // The field does not exist if (!isset($GLOBALS['TL_DCA'][$dcDriver->table]['fields'][$fieldName])) { - System::log( + $this->logger->log( + LogLevel::ERROR, 'Field "' . $fieldName . '" does not exist in DCA "' . $dcDriver->table . '"', - __METHOD__, - 'error' + [ + 'contao' => new ContaoContext( + __CLASS__ . '::' . __FUNCTION__, + 'MCW Execute Post Action' + ) + ] ); throw new BadRequestHttpException('Bad request'); } @@ -82,6 +99,7 @@ public function createWidgetContao(CreateWidgetEvent $event) $widgetClassName = $GLOBALS['BE_FFL'][$inputType]; /** @var MultiColumnWizard $widget */ + /** @var MultiColumnWizard $widgetClassName */ $widget = new $widgetClassName( $widgetClassName::getAttributesFromDca( $GLOBALS['TL_DCA'][$dcDriver->table]['fields'][$fieldName], diff --git a/src/MultiColumnWizardBundle.php b/src/MultiColumnWizardBundle.php index 9a58b5e..ae13c87 100644 --- a/src/MultiColumnWizardBundle.php +++ b/src/MultiColumnWizardBundle.php @@ -34,9 +34,6 @@ */ class MultiColumnWizardBundle extends Bundle { - public const SCOPE_BACKEND = 'backend'; - public const SCOPE_FRONTEND = 'frontend'; - /** * {@inheritdoc} */ diff --git a/src/Resources/config/listener.yml b/src/Resources/config/listener.yml index acf4710..d04daea 100644 --- a/src/Resources/config/listener.yml +++ b/src/Resources/config/listener.yml @@ -43,6 +43,8 @@ services: method: executeEvent MenAtWork\MultiColumnWizardBundle\EventListener\Mcw\CreateWidget: + arguments: + - '@monolog.logger.contao' tags: - name: kernel.event_listener event: men-at-work.multi-column-wizard-bundle.create-widget diff --git a/src/Resources/config/services.yml b/src/Resources/config/services.yml index 8e4adb6..dfd2b30 100644 --- a/src/Resources/config/services.yml +++ b/src/Resources/config/services.yml @@ -3,12 +3,22 @@ services: public: true arguments: - '@event_dispatcher' + - '@MenAtWork\MultiColumnWizardBundle\Service\ContaoApiService' + - '@monolog.logger.contao' MenAtWork\MultiColumnWizardBundle\EventListener\Contao\InitializeSystem: public: true + arguments: + - '@MenAtWork\MultiColumnWizardBundle\Service\ContaoApiService' MenAtWork\MultiColumnWizardBundle\EventListener\Contao\LoadDataContainer: public: true MenAtWork\MultiColumnWizardBundle\EventListener\Contao\ParseTemplate: public: true + + MenAtWork\MultiColumnWizardBundle\Service\ContaoApiService: + public: true + arguments: + - '@request_stack' + - '@contao.routing.scope_matcher' diff --git a/src/Resources/contao/config/config.php b/src/Resources/contao/config/config.php index 503050f..fb603e6 100644 --- a/src/Resources/contao/config/config.php +++ b/src/Resources/contao/config/config.php @@ -26,38 +26,20 @@ * @filesource */ -$GLOBALS['BE_FFL']['multiColumnWizard'] = '\MenAtWork\MultiColumnWizardBundle\Contao\Widgets\MultiColumnWizard'; +use MenAtWork\MultiColumnWizardBundle\Contao\Widgets\MultiColumnWizard; +use MenAtWork\MultiColumnWizardBundle\EventListener\Contao\LoadDataContainer; +use MenAtWork\MultiColumnWizardBundle\EventListener\Contao\InitializeSystem; +use MenAtWork\MultiColumnWizardBundle\EventListener\Contao\ExecutePostActions; -$GLOBALS['TL_HOOKS']['loadDataContainer'][] = array( - 'MenAtWork\MultiColumnWizardBundle\EventListener\Contao\LoadDataContainer', - 'supportModalSelector' -); -$GLOBALS['TL_HOOKS']['initializeSystem'][] = array( - 'MenAtWork\MultiColumnWizardBundle\EventListener\Contao\InitializeSystem', - 'changeAjaxPostActions' -); -$GLOBALS['TL_HOOKS']['executePostActions'][] = array( - 'MenAtWork\MultiColumnWizardBundle\EventListener\Contao\ExecutePostActions', - 'executePostActions' -); -$GLOBALS['TL_HOOKS']['executePostActions'][] = array( - 'MenAtWork\MultiColumnWizardBundle\EventListener\Contao\ExecutePostActions', - 'handleRowCreation' -); +$GLOBALS['BE_FFL']['multiColumnWizard'] = MultiColumnWizard::class; -if (TL_MODE == 'BE') { - $GLOBALS['TL_HOOKS']['parseTemplate'][] = array( - 'MenAtWork\MultiColumnWizardBundle\EventListener\Contao\ParseTemplate', - 'addVersion' - ); +$GLOBALS['TL_HOOKS']['loadDataContainer'][] = [LoadDataContainer::class, 'supportModalSelector']; +$GLOBALS['TL_HOOKS']['initializeSystem'][] = [InitializeSystem::class, 'addSystemNecessaryThings']; +$GLOBALS['TL_HOOKS']['initializeSystem'][] = [InitializeSystem::class, 'changeAjaxPostActions']; +$GLOBALS['TL_HOOKS']['executePostActions'][] = [ExecutePostActions::class, 'executePostActions']; +$GLOBALS['TL_HOOKS']['executePostActions'][] = [ExecutePostActions::class, 'handleRowCreation']; - // Add the JS. - $GLOBALS['TL_JAVASCRIPT']['multicolumnwizard'] = $GLOBALS['TL_CONFIG']['debugMode'] - ? 'bundles/multicolumnwizard/js/multicolumnwizard_be_src.js' - : 'bundles/multicolumnwizard/js/multicolumnwizard_be.js'; - - // Add the css. - $GLOBALS['TL_CSS']['multicolumnwizard'] = $GLOBALS['TL_CONFIG']['debugMode'] - ? 'bundles/multicolumnwizard/css/multicolumnwizard_src.css' - : 'bundles/multicolumnwizard/css/multicolumnwizard.css'; -} +/* + * All Hooks for the BE are moved to the following function: + * \MenAtWork\MultiColumnWizardBundle\EventListener\Contao\InitializeSystem::addSystemNecessaryThings + */ \ No newline at end of file diff --git a/src/Service/ContaoApiService.php b/src/Service/ContaoApiService.php new file mode 100644 index 0000000..64a7938 --- /dev/null +++ b/src/Service/ContaoApiService.php @@ -0,0 +1,80 @@ + + * @copyright 2013-2023 MEN AT WORK + * @license https://github.com/menatwork/contao-multicolumnwizard-bundle/blob/master/LICENSE LGPL-3.0-or-later + * @filesource + */ + +namespace MenAtWork\MultiColumnWizardBundle\Service; + +use Composer\InstalledVersions; +use Contao\CoreBundle\Routing\ScopeMatcher; +use Symfony\Component\HttpFoundation\RequestStack; + +class ContaoApiService +{ + private RequestStack $requestStack; + private ScopeMatcher $scopeMatcher; + + public function __construct( + RequestStack $requestStack, + ScopeMatcher $scopeMatcher + ) { + $this->requestStack = $requestStack; + $this->scopeMatcher = $scopeMatcher; + } + + /** + * Check if we are in the BE mode. + * Replacement for TL_MODE == 'BE'. + * + * @return bool + */ + public function isBackend(): bool + { + // If we use the console this result in a return value of null. + if (null === $this->requestStack->getCurrentRequest()) { + return false; + } + + return $this->scopeMatcher->isBackendRequest($this->requestStack->getCurrentRequest()); + } + + /** + * Check if we are in the FE mode. + * Replacement for TL_MODE == 'FE'. + * + * @return bool + */ + public function isFrontend(): bool + { + // If we use the console this result in a return value of null. + if (null === $this->requestStack->getCurrentRequest()) { + return false; + } + + return $this->scopeMatcher->isFrontendRequest($this->requestStack->getCurrentRequest()); + } + + /** + * Get the version of the current Contao. + * + * @return string|null + */ + public function getContaoVersion(): ?string + { + return InstalledVersions::getPrettyVersion('contao/core-bundle'); + } +} \ No newline at end of file From da466a2e7bdd547845927cdce013f62021b162bf Mon Sep 17 00:00:00 2001 From: Stefan Heimes Date: Sun, 5 Feb 2023 23:27:52 +0100 Subject: [PATCH 37/59] Change the diagnostics.yml - Add the new Contao Version and remove the old V4 --- .github/workflows/diagnostics.yml | 32 ++++--------------------------- 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/.github/workflows/diagnostics.yml b/.github/workflows/diagnostics.yml index e3f4998..5039b17 100644 --- a/.github/workflows/diagnostics.yml +++ b/.github/workflows/diagnostics.yml @@ -13,38 +13,14 @@ jobs: fail-fast: false matrix: include: - - contao: '~4.9.0' - php: '7.4' - phpcq_install: 'update' - phpcq_flags: '' - - contao: '~4.9.0' - php: '8.0' - phpcq_install: 'update' - phpcq_flags: '' - - contao: '~4.9.0' - php: '8.1' - phpcq_install: 'update' - phpcq_flags: '' - - contao: '~4.9.0' - php: '8.2' - phpcq_install: 'update' - phpcq_flags: '--exit-0' - - contao: '~4.13.0' - php: '7.4' - phpcq_install: 'update' - phpcq_flags: '' - - contao: '~4.13.0' - php: '8.0' - phpcq_install: 'update' - phpcq_flags: '' - - contao: '~4.13.0' + - contao: '~5.1.0' php: '8.1' phpcq_install: 'update' phpcq_flags: '' - - contao: '~4.13.0' - php: '8.2' + - contao: '~5.1.0' + php: '8.2' phpcq_install: 'update' - phpcq_flags: '--exit-0' + phpcq_flags: '' steps: - name: PHP ${{ matrix.php }} ${{ matrix.contao }} Pull source From 54d3ccf9cc78260514024e57c55e365216af7e57 Mon Sep 17 00:00:00 2001 From: Stefan Heimes Date: Sun, 5 Feb 2023 23:32:40 +0100 Subject: [PATCH 38/59] Add minimum-stability dev for the gitaction --- .github/workflows/diagnostics.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/diagnostics.yml b/.github/workflows/diagnostics.yml index 5039b17..f0f3052 100644 --- a/.github/workflows/diagnostics.yml +++ b/.github/workflows/diagnostics.yml @@ -53,6 +53,9 @@ jobs: restore-keys: | ${{ runner.os }}-build-${{ env.cache-name }}- + - name: PHP ${{ matrix.php }} ${{ matrix.contao }} Setup composer config + run: composer config minimum-stability dev + - name: PHP ${{ matrix.php }} ${{ matrix.contao }} Install composer dependencies run: composer update --no-interaction --no-progress --no-suggest --prefer-dist --prefer-stable From bc4549febf76a14e382e67fe19d130345609c748 Mon Sep 17 00:00:00 2001 From: Stefan Heimes Date: Sun, 5 Feb 2023 23:46:55 +0100 Subject: [PATCH 39/59] Correct the function for creating the response object - This fix a problem with the AJAX for creating new rows. --- src/EventListener/BaseListener.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/EventListener/BaseListener.php b/src/EventListener/BaseListener.php index dc82f53..a55ab17 100644 --- a/src/EventListener/BaseListener.php +++ b/src/EventListener/BaseListener.php @@ -71,8 +71,8 @@ protected function getNewClassInstance($strClass) * * @return Response */ - protected function convertToResponse($str) + protected function convertToResponse(string $str): Response { - return new Response(Controller::replaceOldBePaths($str)); + return new Response($str); } } From 79dd2cdccd1b3ff633b711b5a79d4fd53754d91c Mon Sep 17 00:00:00 2001 From: e-spin Date: Mon, 6 Feb 2023 14:31:49 +0100 Subject: [PATCH 40/59] Fix PHP 8 warnings --- .check-author.yml | 4 +--- src/Contao/Widgets/MultiColumnWizard.php | 9 +++++---- src/EventListener/Contao/ExecutePostActions.php | 12 ++++++++---- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.check-author.yml b/.check-author.yml index 5ad9ac0..99676be 100644 --- a/.check-author.yml +++ b/.check-author.yml @@ -17,9 +17,7 @@ mapping: - "unknown " 'Ingolf Steinhardt ': - 'zonky2 ' + - 'info@e-spin.de ' "Fritz Michael Gschwantner ": - "fritzmg " - "fritzmg " - -copy-left: - diff --git a/src/Contao/Widgets/MultiColumnWizard.php b/src/Contao/Widgets/MultiColumnWizard.php index 1ccb306..2a0e6b5 100644 --- a/src/Contao/Widgets/MultiColumnWizard.php +++ b/src/Contao/Widgets/MultiColumnWizard.php @@ -3,7 +3,7 @@ /** * This file is part of menatwork/contao-multicolumnwizard-bundle. * - * (c) 2012-2022 MEN AT WORK. + * (c) 2012-2023 MEN AT WORK. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -40,11 +40,10 @@ * @author Andreas Dziemba * @author Fritz Michael Gschwantner * @author doishub - * @author info@e-spin.de * @author David Greminger * @copyright 2011 Andreas Schempp * @copyright 2011 certo web & design GmbH - * @copyright 2013-2022 MEN AT WORK + * @copyright 2013-2023 MEN AT WORK * @license https://github.com/menatwork/contao-multicolumnwizard-bundle/blob/master/LICENSE LGPL-3.0-or-later * @filesource */ @@ -1019,7 +1018,9 @@ protected function initializeWidget(&$arrField, $intRow, $strKey, $varValue) } // pass activeRecord to widget - $arrField['activeRecord'] = $this->activeRecord; + if (isset($this->activeRecord)) { + $arrField['activeRecord'] = $this->activeRecord; + } // Toggle line wrap (textarea) if (($arrField['inputType'] ?? null) == 'textarea' && $arrField['eval']['rte'] == '') { diff --git a/src/EventListener/Contao/ExecutePostActions.php b/src/EventListener/Contao/ExecutePostActions.php index f1b406c..05c74ef 100644 --- a/src/EventListener/Contao/ExecutePostActions.php +++ b/src/EventListener/Contao/ExecutePostActions.php @@ -3,7 +3,7 @@ /** * This file is part of menatwork/contao-multicolumnwizard-bundle. * - * (c) 2012-2020 MEN AT WORK. + * (c) 2012-2023 MEN AT WORK. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -16,9 +16,10 @@ * @author Stefan Heimes * @author Sven Baumann * @author Fritz Michael Gschwantner + * @author Ingolf Steinhardt * @copyright 2011 Andreas Schempp * @copyright 2011 certo web & design GmbH - * @copyright 2013-2020 MEN AT WORK + * @copyright 2013-2023 MEN AT WORK * @license https://github.com/menatwork/contao-multicolumnwizard-bundle/blob/master/LICENSE LGPL-3.0-or-later * @filesource */ @@ -265,8 +266,11 @@ public function executePostActions($action, DataContainer $container) } } - // Call the load_callback - if (\is_array($GLOBALS['TL_DCA'][$container->table]['fields'][$strField]['load_callback'])) { + // Call the load_callback. + if ( + isset($GLOBALS['TL_DCA'][$container->table]['fields'][$strField]['load_callback']) + && \is_array($GLOBALS['TL_DCA'][$container->table]['fields'][$strField]['load_callback']) + ) { foreach ($GLOBALS['TL_DCA'][$container->table]['fields'][$strField]['load_callback'] as $callback) { if (\is_array($callback)) { $this->import($callback[0]); From bae19390a4b875acef66c10a89c79b88d74a4cd7 Mon Sep 17 00:00:00 2001 From: e-spin Date: Mon, 6 Feb 2023 15:39:25 +0100 Subject: [PATCH 41/59] Fix debugmode --- src/EventListener/Contao/InitializeSystem.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/EventListener/Contao/InitializeSystem.php b/src/EventListener/Contao/InitializeSystem.php index 887e975..30910fc 100644 --- a/src/EventListener/Contao/InitializeSystem.php +++ b/src/EventListener/Contao/InitializeSystem.php @@ -3,7 +3,7 @@ /** * This file is part of menatwork/contao-multicolumnwizard-bundle. * - * (c) 2012-2019 MEN AT WORK. + * (c) 2012-2023 MEN AT WORK. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -13,9 +13,10 @@ * @package menatwork/contao-multicolumnwizard-bundle * @author Christian Schiffler * @author Stefan Heimes + * @author Ingolf Steinhardt * @copyright 2011 Andreas Schempp * @copyright 2011 certo web & design GmbH - * @copyright 2013-2019 MEN AT WORK + * @copyright 2013-2023 MEN AT WORK * @license https://github.com/menatwork/contao-multicolumnwizard-bundle/blob/master/LICENSE LGPL-3.0-or-later * @filesource */ @@ -59,12 +60,12 @@ public function addSystemNecessaryThings(): void $GLOBALS['TL_HOOKS']['parseTemplate'][] = [ParseTemplate::class, 'addVersion']; // Add the JS. - $GLOBALS['TL_JAVASCRIPT']['multicolumnwizard'] = $GLOBALS['TL_CONFIG']['debugMode'] + $GLOBALS['TL_JAVASCRIPT']['multicolumnwizard'] = System::getContainer()->get('kernel')->isDebug() ? 'bundles/multicolumnwizard/js/multicolumnwizard_be_src.js' : 'bundles/multicolumnwizard/js/multicolumnwizard_be.js'; // Add the css. - $GLOBALS['TL_CSS']['multicolumnwizard'] = $GLOBALS['TL_CONFIG']['debugMode'] + $GLOBALS['TL_CSS']['multicolumnwizard'] = System::getContainer()->get('kernel')->isDebug() ? 'bundles/multicolumnwizard/css/multicolumnwizard_src.css' : 'bundles/multicolumnwizard/css/multicolumnwizard.css'; } From afdd708db6b9f14574042f919cb2de719aa7d1d2 Mon Sep 17 00:00:00 2001 From: e-spin Date: Mon, 6 Feb 2023 16:30:04 +0100 Subject: [PATCH 42/59] Add language keys --- src/Resources/contao/languages/de/default.php | 6 ++++-- src/Resources/contao/languages/en/default.php | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Resources/contao/languages/de/default.php b/src/Resources/contao/languages/de/default.php index cf77ce9..e2e98c8 100644 --- a/src/Resources/contao/languages/de/default.php +++ b/src/Resources/contao/languages/de/default.php @@ -3,7 +3,7 @@ /** * This file is part of menatwork/contao-multicolumnwizard-bundle. * - * (c) 2012-2019 MEN AT WORK. + * (c) 2012-2023 MEN AT WORK. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -13,9 +13,10 @@ * @package menatwork/contao-multicolumnwizard-bundle * @author Stefan Heimes * @author Christian Schiffler + * @author Ingolf Steinhardt * @copyright 2011 Andreas Schempp * @copyright 2011 certo web & design GmbH - * @copyright 2013-2019 MEN AT WORK + * @copyright 2013-2023 MEN AT WORK * @license https://github.com/menatwork/contao-multicolumnwizard-bundle/blob/master/LICENSE LGPL-3.0-or-later * @filesource */ @@ -24,3 +25,4 @@ $GLOBALS['TL_LANG']['ERR']['mcwMaxCount'] = 'Es dürfen höchstens %s Zeilen ausgefüllt werden!'; $GLOBALS['TL_LANG']['MSC']['tw_rnew'] = 'Eine neue Reihe erstellen.'; $GLOBALS['TL_LANG']['MSC']['tw_rmove'] = 'Die Reihe verschieben.'; +$GLOBALS['TL_LANG']['MSC']['fileManager'] = 'Dateiverwaltung'; diff --git a/src/Resources/contao/languages/en/default.php b/src/Resources/contao/languages/en/default.php index 320f6db..375f310 100644 --- a/src/Resources/contao/languages/en/default.php +++ b/src/Resources/contao/languages/en/default.php @@ -3,7 +3,7 @@ /** * This file is part of menatwork/contao-multicolumnwizard-bundle. * - * (c) 2012-2019 MEN AT WORK. + * (c) 2012-2023 MEN AT WORK. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -13,9 +13,10 @@ * @package menatwork/contao-multicolumnwizard-bundle * @author Stefan Heimes * @author Christian Schiffler + * @author Ingolf Steinhardt * @copyright 2011 Andreas Schempp * @copyright 2011 certo web & design GmbH - * @copyright 2013-2019 MEN AT WORK + * @copyright 2013-2023 MEN AT WORK * @license https://github.com/menatwork/contao-multicolumnwizard-bundle/blob/master/LICENSE LGPL-3.0-or-later * @filesource */ @@ -24,3 +25,4 @@ $GLOBALS['TL_LANG']['ERR']['mcwMaxCount'] = 'At most %s rows are allowed!'; $GLOBALS['TL_LANG']['MSC']['tw_rnew'] = 'Ad a new row.'; $GLOBALS['TL_LANG']['MSC']['tw_rmove'] = 'Move the row.'; +$GLOBALS['TL_LANG']['MSC']['fileManager'] = 'File manager'; From 92dcec9de92e08c7b41977d02715180a56e6d12d Mon Sep 17 00:00:00 2001 From: Andreas Schempp Date: Tue, 7 Feb 2023 09:41:53 +0100 Subject: [PATCH 43/59] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 8f1bd56..080e306 100644 --- a/composer.json +++ b/composer.json @@ -55,7 +55,7 @@ "require": { "php": "^8.1", "ext-json": "*", - "contao/core-bundle": "^5.1", + "contao/core-bundle": "^4.13 || ^5.0", "symfony/config": "^5.4 || ^6.0", "symfony/console": "^5.4 || ^6.0", "symfony/dependency-injection": "^5.4 || ^6.0", From 4f0ee495ceeb2f16093fd9919a605e3c4d0d546e Mon Sep 17 00:00:00 2001 From: Stefan Heimes Date: Wed, 8 Feb 2023 00:40:21 +0100 Subject: [PATCH 44/59] Update the workflow config for the tests. --- .github/workflows/diagnostics.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/diagnostics.yml b/.github/workflows/diagnostics.yml index f0f3052..e341a7d 100644 --- a/.github/workflows/diagnostics.yml +++ b/.github/workflows/diagnostics.yml @@ -13,6 +13,14 @@ jobs: fail-fast: false matrix: include: + - contao: '~4.13.0' + php: '8.1' + phpcq_install: 'update' + phpcq_flags: '' + - contao: '~4.13.0' + php: '8.2' + phpcq_install: 'update' + phpcq_flags: '--exit-0' - contao: '~5.1.0' php: '8.1' phpcq_install: 'update' @@ -20,7 +28,7 @@ jobs: - contao: '~5.1.0' php: '8.2' phpcq_install: 'update' - phpcq_flags: '' + phpcq_flags: '--exit-0' steps: - name: PHP ${{ matrix.php }} ${{ matrix.contao }} Pull source @@ -36,7 +44,7 @@ jobs: coverage: none - name: PHP ${{ matrix.php }} ${{ matrix.contao }} Cache composer cache directory - uses: actions/cache@v1 + uses: actions/cache@v3 env: cache-name: composer-cache-dir-${{ matrix.php }}-${{ matrix.contao }} with: @@ -44,7 +52,7 @@ jobs: key: ${{ runner.os }}-build-${{ env.cache-name }} - name: PHP ${{ matrix.php }} ${{ matrix.contao }} Cache vendor directory - uses: actions/cache@v1 + uses: actions/cache@v3 env: cache-name: composer-vendor-${{ matrix.php }}-${{ matrix.contao }} with: @@ -69,7 +77,7 @@ jobs: run: ./vendor/bin/phpcq run -v -o github-action -o default ${{ matrix.phpcq_flags }} - name: PHP ${{ matrix.php }} ${{ matrix.contao }} Upload build directory to artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: ${{ success() }} || ${{ failure() }} with: name: phpcq-builds-php-${{ matrix.php }}-${{ matrix.contao }} From fba7ec45d0bc6ef2d5091ceda61382db58e332f2 Mon Sep 17 00:00:00 2001 From: Andreas Schempp Date: Wed, 15 Feb 2023 17:01:21 +0100 Subject: [PATCH 45/59] Fixed several PHP8 warnings --- src/Contao/Widgets/MultiColumnWizard.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Contao/Widgets/MultiColumnWizard.php b/src/Contao/Widgets/MultiColumnWizard.php index 7235cd3..758e212 100644 --- a/src/Contao/Widgets/MultiColumnWizard.php +++ b/src/Contao/Widgets/MultiColumnWizard.php @@ -941,7 +941,7 @@ function ($value) { } // Build array of items - if (isset($arrField['eval']['columnPos']) && $arrField['eval']['columnPos'] != '') { + if (!empty($arrField['eval']['columnPos'])) { $arrItems[$i][$objWidget->columnPos]['entry'] = ($arrItems[$i][$objWidget->columnPos]['entry'] ?? '') . $strWidget; $arrItems[$i][$objWidget->columnPos]['valign'] = ($arrField['eval']['valign'] ?? ''); @@ -952,7 +952,7 @@ function ($value) { ( 'entry' => $strWidget, 'valign' => $arrField['eval']['valign'] ?? null, - 'tl_class' => $arrField['eval']['tl_class'], + 'tl_class' => $arrField['eval']['tl_class'] ?? null, 'hide' => $blnHiddenBody ); } @@ -1030,7 +1030,7 @@ protected function initializeWidget(&$arrField, $intRow, $strKey, $varValue) } // Toggle line wrap (textarea) - if (($arrField['inputType'] ?? null) == 'textarea' && $arrField['eval']['rte'] == '') { + if (($arrField['inputType'] ?? null) == 'textarea' && empty($arrField['eval']['rte'])) { $xlabel .= ' ' . Image::getHtml( 'wrap.gif', @@ -1141,9 +1141,9 @@ protected function initializeWidget(&$arrField, $intRow, $strKey, $varValue) ->{$arrField['input_field_callback'][1]}($this, $xlabel); } - $strClass = $GLOBALS[($this->contaoApi->isBackend() ? 'BE_FFL' : 'TL_FFL')][$arrField['inputType']]; + $strClass = $GLOBALS[($this->contaoApi->isBackend() ? 'BE_FFL' : 'TL_FFL')][$arrField['inputType'] ?? null] ?? null; - if ($strClass == '' || !class_exists($strClass)) { + if (empty($strClass) || !class_exists($strClass)) { return null; } From 6ddaf48f52df164eb8cc99ebeecadfc88b9645f2 Mon Sep 17 00:00:00 2001 From: Andreas Schempp Date: Wed, 15 Feb 2023 17:04:07 +0100 Subject: [PATCH 46/59] Support closure as input_field_callback --- src/Contao/Widgets/MultiColumnWizard.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/Contao/Widgets/MultiColumnWizard.php b/src/Contao/Widgets/MultiColumnWizard.php index 7235cd3..6b8a070 100644 --- a/src/Contao/Widgets/MultiColumnWizard.php +++ b/src/Contao/Widgets/MultiColumnWizard.php @@ -1131,14 +1131,21 @@ protected function initializeWidget(&$arrField, $intRow, $strKey, $varValue) } // Input field callback - if (isset($arrField['input_field_callback']) && is_array($arrField['input_field_callback'])) { - if (!is_object($this->{$arrField['input_field_callback'][0]})) { - $this->import($arrField['input_field_callback'][0]); + if (isset($arrField['input_field_callback'])) { + if (is_array($arrField['input_field_callback'])) { + if (!is_object($this->{$arrField['input_field_callback'][0]})) { + $this->import($arrField['input_field_callback'][0]); + } + + return $this + ->{$arrField['input_field_callback'][0]} + ->{$arrField['input_field_callback'][1]}($this, $xlabel) + ; } - return $this - ->{$arrField['input_field_callback'][0]} - ->{$arrField['input_field_callback'][1]}($this, $xlabel); + if (\is_callable($arrField['input_field_callback'])) { + return $arrField['input_field_callback']($this, $xlabel); + } } $strClass = $GLOBALS[($this->contaoApi->isBackend() ? 'BE_FFL' : 'TL_FFL')][$arrField['inputType']]; From 85cd8a80ec5466370d3cb98d8fbe229c4d8a67ad Mon Sep 17 00:00:00 2001 From: Stefan Heimes Date: Sun, 19 Mar 2023 22:15:59 +0100 Subject: [PATCH 47/59] Corrections for phpcq --- .composer-require-checker.json | 8 +- .phpcq.lock | 2 +- composer.json | 225 +++++++++--------- src/Contao/Widgets/MultiColumnWizard.php | 3 +- src/EventListener/Contao/InitializeSystem.php | 2 + src/Resources/contao/config/config.php | 2 +- src/Service/ContaoApiService.php | 2 +- tests/DeprecatedAutoloaderTest.php | 10 + 8 files changed, 136 insertions(+), 118 deletions(-) diff --git a/.composer-require-checker.json b/.composer-require-checker.json index 77ff2ad..4dda737 100644 --- a/.composer-require-checker.json +++ b/.composer-require-checker.json @@ -3,7 +3,7 @@ "null", "true", "false", "self", "parent", "array", "string", "int", "float", "bool", "iterable", "callable", "void", "object", - "BUILD", "VERSION", + "BUILD", "VERSION", "TL_MODE", "Symfony\\Contracts\\EventDispatcher\\Event", "DC_General", "ContaoCommunityAlliance\\DcGeneral\\ContaoFrontend\\View\\WidgetManager", @@ -23,6 +23,10 @@ "Contao\\ManagerPlugin\\Bundle\\Config\\BundleConfig", "Contao\\ManagerPlugin\\Bundle\\Parser\\ParserInterface", "Contao\\ManagerPlugin\\Config\\ConfigPluginInterface", - "Contao\\ManagerPlugin\\Routing\\RoutingPluginInterface" + "Contao\\ManagerPlugin\\Routing\\RoutingPluginInterface", + "Composer\\InstalledVersions", + "Monolog\\Logger", + "Psr\\Log\\LogLevel", + "" ] } diff --git a/.phpcq.lock b/.phpcq.lock index f78589e..ff8adb5 100644 --- a/.phpcq.lock +++ b/.phpcq.lock @@ -1 +1 @@ -{"plugins":{"phpunit":{"api-version":"1.0.0","version":"1.0.0.0","type":"php-file","url":"https://phpcq.github.io/repository/phpunit-1.0.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0"},"tool":{"phpunit":"^6.0 || ^7.0 || ^8.0 || ^9.0"}},"checksum":{"type":"sha-512","value":"c73f15658e3ba62665f09492ec91c3a6a715760bfaa88473a987538439fff442540148e086e46a6aa18ce55a3ea2fbf76caaa581384cb84a38859fcc609ae7e4"},"tools":{"phpunit":{"version":"9.5.20","url":"https://phar.phpunit.de/phpunit-9.5.20.phar","requirements":{"php":{"php":">=7.3","ext-dom":"*","ext-json":"*","ext-libxml":"*","ext-mbstring":"*","ext-xml":"*","ext-xmlwriter":"*"}},"checksum":{"type":"sha-256","value":"6becad2da5c37f5ad101cc665ef05a2f1a6a45d2427c8edcc74f72c92fb1e05a"},"signature":"https://phar.phpunit.de/phpunit-9.5.20.phar.asc"}}},"composer-require-checker":{"api-version":"1.0.0","version":"1.0.1.0","type":"php-file","url":"https://phpcq.github.io/repository/composer-require-checker-1.0.1.0.php","signature":null,"requirements":{"php":{"php":"^7.4 || ^8.0"},"tool":{"composer-require-checker":"^3.8"}},"checksum":{"type":"sha-512","value":"5b0fd8cd5e0f5761c53b9d5375b6f6ba50f148468896248f823cc2a48361adfd872556066764b1b544ff51ffd5de60d6f9a75050db00b257d807976ac761bc3a"},"tools":{"composer-require-checker":{"version":"3.8.0","url":"https://github.com/maglnet/ComposerRequireChecker/releases/download/3.8.0/composer-require-checker.phar","requirements":{"php":{"php":"^7.4 || ^8.0","ext-json":"*","ext-phar":"*"}},"checksum":null,"signature":"https://github.com/maglnet/ComposerRequireChecker/releases/download/3.8.0/composer-require-checker.phar.asc"}}},"phpmd":{"api-version":"1.0.0","version":"1.0.1.0","type":"php-file","url":"https://phpcq.github.io/repository/phpmd-1.0.1.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpmd":"^2.6.1"}},"checksum":{"type":"sha-512","value":"88e267b9c36b2edc85e924717606b626e005ac8d97b1f65f5331e2a3b3894dec2cf124f6187541bf759d026477b6d94daacc5d5c81bb09714a68ffabe5698dc5"},"tools":{"phpmd":{"version":"2.12.0","url":"https://github.com/phpmd/phpmd/releases/download/2.12.0/phpmd.phar","requirements":{"php":{"php":">=5.3.9","ext-xml":"*"}},"checksum":null,"signature":null}}},"phpcpd":{"api-version":"1.0.0","version":"1.1.1.0","type":"php-file","url":"https://phpcq.github.io/repository/phpcpd-1.1.1.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpcpd":"^6.0"}},"checksum":{"type":"sha-512","value":"1189ce0bf3fade4cb4241f1d96f915ef8fc7651f4450dc79fdf464ee3d6be3009316f0d423ce2d4af9d76ad50807b7fdf4d77bfa6d9ee2c91d6eda32ea214433"},"tools":{"phpcpd":{"version":"6.0.3","url":"https://phar.phpunit.de/phpcpd-6.0.3.phar","requirements":{"php":{"php":">=7.3","ext-dom":"*"}},"checksum":{"type":"sha-256","value":"2cbaea7cfda1bb4299d863eb075e977c3f49055dd16d88529fae5150d48a84cb"},"signature":"https://phar.phpunit.de/phpcpd-6.0.3.phar.asc"}}},"phploc":{"api-version":"1.0.0","version":"1.0.0.0","type":"php-file","url":"https://phpcq.github.io/repository/phploc-1.0.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*","ext-json":"*"},"tool":{"phploc":"^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0"}},"checksum":{"type":"sha-512","value":"f67b02d494796adf553cb3dd13ec06c1cb8e53c799954061749424251379541637538199afb3afa3c7a01cabd1cb6f1c53eb621f015dff9644c6c7cbf10c56d1"},"tools":{"phploc":{"version":"7.0.2","url":"https://phar.phpunit.de/phploc-7.0.2.phar","requirements":{"php":{"php":">=7.3","ext-dom":"*","ext-json":"*"}},"checksum":{"type":"sha-256","value":"3d59778ec86faf25fd00e3a329b2f9ad4a3c751ca91601ea7dab70f887b0bf46"},"signature":"https://phar.phpunit.de/phploc-7.0.2.phar.asc"}}},"phpcs":{"api-version":"1.0.0","version":"1.1.0.0","type":"php-file","url":"https://phpcq.github.io/repository/phpcs-1.1.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpcs":"^3.0 || ^2.0","phpcbf":"^3.0 || ^2.0"}},"checksum":{"type":"sha-512","value":"2737022369da1318cc4e0ea194e8a81019f7b079080d869aab878b7486052fdbe68fee3f28131f35573226def1aabd4bd005e038ee7b767c137b1107c1492a83"},"tools":{"phpcs":{"version":"3.6.2","url":"https://github.com/squizlabs/PHP_CodeSniffer/releases/download/3.6.2/phpcs.phar","requirements":{"php":{"php":">=5.4.0","ext-tokenizer":"*","ext-xmlwriter":"*","ext-simplexml":"*"}},"checksum":null,"signature":"https://github.com/squizlabs/PHP_CodeSniffer/releases/download/3.6.2/phpcs.phar.asc"},"phpcbf":{"version":"3.6.2","url":"https://github.com/squizlabs/PHP_CodeSniffer/releases/download/3.6.2/phpcbf.phar","requirements":{"php":{"php":">=5.4.0","ext-tokenizer":"*","ext-xmlwriter":"*","ext-simplexml":"*"}},"checksum":null,"signature":"https://github.com/squizlabs/PHP_CodeSniffer/releases/download/3.6.2/phpcbf.phar.asc"}}},"composer-normalize":{"api-version":"1.0.0","version":"1.1.0.0","type":"php-file","url":"https://phpcq.github.io/repository/composer-normalize-1.1.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-json":"*"},"tool":{"composer-normalize":"^2.1"}},"checksum":{"type":"sha-512","value":"d59d3557cb20630734878a9115df5dd32d5aff815e5b15be36f6fb5d6e9d83dd36efd84215ab6529edcc924f600946f739a0d9e67723deff95c88346ab502498"},"tools":{"composer-normalize":{"version":"2.25.1","url":"https://github.com/ergebnis/composer-normalize/releases/download/2.25.1/composer-normalize.phar","requirements":{"php":{"php":"^7.4 || ^8.0"}},"checksum":null,"signature":"https://github.com/ergebnis/composer-normalize/releases/download/2.25.1/composer-normalize.phar.asc"}}}},"tools":[]} \ No newline at end of file +{"plugins":{"phpunit":{"api-version":"1.0.0","version":"1.0.0.0","type":"php-file","url":"https://phpcq.github.io/repository/phpunit-1.0.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0"},"tool":{"phpunit":"^6.0 || ^7.0 || ^8.0 || ^9.0"}},"checksum":{"type":"sha-512","value":"c73f15658e3ba62665f09492ec91c3a6a715760bfaa88473a987538439fff442540148e086e46a6aa18ce55a3ea2fbf76caaa581384cb84a38859fcc609ae7e4"},"tools":{"phpunit":{"version":"9.5.20","url":"https://phar.phpunit.de/phpunit-9.5.20.phar","requirements":{"php":{"php":">=7.3","ext-dom":"*","ext-json":"*","ext-libxml":"*","ext-mbstring":"*","ext-xml":"*","ext-xmlwriter":"*"}},"checksum":{"type":"sha-256","value":"6becad2da5c37f5ad101cc665ef05a2f1a6a45d2427c8edcc74f72c92fb1e05a"},"signature":"https://phar.phpunit.de/phpunit-9.5.20.phar.asc"}},"composerLock":null},"composer-require-checker":{"api-version":"1.0.0","version":"1.0.1.0","type":"php-file","url":"https://phpcq.github.io/repository/composer-require-checker-1.0.1.0.php","signature":null,"requirements":{"php":{"php":"^7.4 || ^8.0"},"tool":{"composer-require-checker":"^3.8"}},"checksum":{"type":"sha-512","value":"5b0fd8cd5e0f5761c53b9d5375b6f6ba50f148468896248f823cc2a48361adfd872556066764b1b544ff51ffd5de60d6f9a75050db00b257d807976ac761bc3a"},"tools":{"composer-require-checker":{"version":"3.8.0","url":"https://github.com/maglnet/ComposerRequireChecker/releases/download/3.8.0/composer-require-checker.phar","requirements":{"php":{"php":"^7.4 || ^8.0","ext-json":"*","ext-phar":"*"}},"checksum":null,"signature":"https://github.com/maglnet/ComposerRequireChecker/releases/download/3.8.0/composer-require-checker.phar.asc"}},"composerLock":null},"phpmd":{"api-version":"1.0.0","version":"1.0.1.0","type":"php-file","url":"https://phpcq.github.io/repository/phpmd-1.0.1.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpmd":"^2.6.1"}},"checksum":{"type":"sha-512","value":"88e267b9c36b2edc85e924717606b626e005ac8d97b1f65f5331e2a3b3894dec2cf124f6187541bf759d026477b6d94daacc5d5c81bb09714a68ffabe5698dc5"},"tools":{"phpmd":{"version":"2.12.0","url":"https://github.com/phpmd/phpmd/releases/download/2.12.0/phpmd.phar","requirements":{"php":{"php":">=5.3.9","ext-xml":"*"}},"checksum":null,"signature":null}},"composerLock":null},"phpcpd":{"api-version":"1.0.0","version":"1.1.1.0","type":"php-file","url":"https://phpcq.github.io/repository/phpcpd-1.1.1.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpcpd":"^6.0"}},"checksum":{"type":"sha-512","value":"1189ce0bf3fade4cb4241f1d96f915ef8fc7651f4450dc79fdf464ee3d6be3009316f0d423ce2d4af9d76ad50807b7fdf4d77bfa6d9ee2c91d6eda32ea214433"},"tools":{"phpcpd":{"version":"6.0.3","url":"https://phar.phpunit.de/phpcpd-6.0.3.phar","requirements":{"php":{"php":">=7.3","ext-dom":"*"}},"checksum":{"type":"sha-256","value":"2cbaea7cfda1bb4299d863eb075e977c3f49055dd16d88529fae5150d48a84cb"},"signature":"https://phar.phpunit.de/phpcpd-6.0.3.phar.asc"}},"composerLock":null},"phploc":{"api-version":"1.0.0","version":"1.0.0.0","type":"php-file","url":"https://phpcq.github.io/repository/phploc-1.0.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*","ext-json":"*"},"tool":{"phploc":"^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0"}},"checksum":{"type":"sha-512","value":"f67b02d494796adf553cb3dd13ec06c1cb8e53c799954061749424251379541637538199afb3afa3c7a01cabd1cb6f1c53eb621f015dff9644c6c7cbf10c56d1"},"tools":{"phploc":{"version":"7.0.2","url":"https://phar.phpunit.de/phploc-7.0.2.phar","requirements":{"php":{"php":">=7.3","ext-dom":"*","ext-json":"*"}},"checksum":{"type":"sha-256","value":"3d59778ec86faf25fd00e3a329b2f9ad4a3c751ca91601ea7dab70f887b0bf46"},"signature":"https://phar.phpunit.de/phploc-7.0.2.phar.asc"}},"composerLock":null},"phpcs":{"api-version":"1.0.0","version":"1.1.0.0","type":"php-file","url":"https://phpcq.github.io/repository/phpcs-1.1.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpcs":"^3.0 || ^2.0","phpcbf":"^3.0 || ^2.0"}},"checksum":{"type":"sha-512","value":"2737022369da1318cc4e0ea194e8a81019f7b079080d869aab878b7486052fdbe68fee3f28131f35573226def1aabd4bd005e038ee7b767c137b1107c1492a83"},"tools":{"phpcs":{"version":"3.6.2","url":"https://github.com/squizlabs/PHP_CodeSniffer/releases/download/3.6.2/phpcs.phar","requirements":{"php":{"php":">=5.4.0","ext-tokenizer":"*","ext-xmlwriter":"*","ext-simplexml":"*"}},"checksum":null,"signature":"https://github.com/squizlabs/PHP_CodeSniffer/releases/download/3.6.2/phpcs.phar.asc"},"phpcbf":{"version":"3.6.2","url":"https://github.com/squizlabs/PHP_CodeSniffer/releases/download/3.6.2/phpcbf.phar","requirements":{"php":{"php":">=5.4.0","ext-tokenizer":"*","ext-xmlwriter":"*","ext-simplexml":"*"}},"checksum":null,"signature":"https://github.com/squizlabs/PHP_CodeSniffer/releases/download/3.6.2/phpcbf.phar.asc"}},"composerLock":null},"composer-normalize":{"api-version":"1.0.0","version":"1.1.0.0","type":"php-file","url":"https://phpcq.github.io/repository/composer-normalize-1.1.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-json":"*"},"tool":{"composer-normalize":"^2.1"}},"checksum":{"type":"sha-512","value":"d59d3557cb20630734878a9115df5dd32d5aff815e5b15be36f6fb5d6e9d83dd36efd84215ab6529edcc924f600946f739a0d9e67723deff95c88346ab502498"},"tools":{"composer-normalize":{"version":"2.25.1","url":"https://github.com/ergebnis/composer-normalize/releases/download/2.25.1/composer-normalize.phar","requirements":{"php":{"php":"^7.4 || ^8.0"}},"checksum":null,"signature":"https://github.com/ergebnis/composer-normalize/releases/download/2.25.1/composer-normalize.phar.asc"}},"composerLock":null}},"tools":[]} \ No newline at end of file diff --git a/composer.json b/composer.json index 080e306..1c03e8c 100644 --- a/composer.json +++ b/composer.json @@ -1,112 +1,113 @@ -{ - "name": "menatwork/contao-multicolumnwizard-bundle", - "description": "MultiColumWizard for Contao OpenSource CMS", - "license": "LGPL-3.0-or-later", - "type": "contao-bundle", - "keywords": [ - "contao", - "widget", - "wizard" - ], - "authors": [ - { - "name": "Stefan Heimes", - "email": "stefan_heimes@hotmail.com", - "homepage": "https://www.men-at-work.de", - "role": "Developer" - }, - { - "name": "Andreas Isaak", - "email": "contao@men-at-work.de", - "homepage": "https://www.men-at-work.de", - "role": "Developer" - }, - { - "name": "David Maack", - "email": "contao@men-at-work.de", - "homepage": "https://www.men-at-work.de", - "role": "Developer" - }, - { - "name": "Andreas Schempp", - "email": "andreas.schempp@terminal42.ch", - "homepage": "https://www.terminal42.ch", - "role": "Developer" - }, - { - "name": "Yanick Witschi", - "email": "yanick.witschi@terminal42.ch", - "homepage": "https://www.terminal42.ch", - "role": "Developer" - }, - { - "name": "Tristan Lins", - "homepage": "https://github.com/tristanlins", - "role": "Developer" - } - ], - "homepage": "https://www.men-at-work.de", - "support": { - "issues": "https://github.com/menatwork/MultiColumnWizard/issues", - "wiki": "https://de.contaowiki.org/MultiColumnWizard", - "irc": "irc://irc.freenode.org/contao.dev", - "source": "https://github.com/menatwork/MultiColumnWizard" - }, - "require": { - "php": "^8.1", - "ext-json": "*", - "contao/core-bundle": "^4.13 || ^5.0", - "symfony/config": "^5.4 || ^6.0", - "symfony/console": "^5.4 || ^6.0", - "symfony/dependency-injection": "^5.4 || ^6.0", - "symfony/event-dispatcher": "^5.4 || ^6.0", - "symfony/http-foundation": "^5.4 || ^6.0", - "symfony/http-kernel": "^5.4 || ^6.0", - "symfony/translation": "^5.4 || ^6.0" - }, - "require-dev": { - "contao/manager-plugin": "^2.1", - "phpcq/runner-bootstrap": "^1.0@dev", - "roave/security-advisories": "dev-latest" - }, - "replace": { - "contao-legacy/multicolumnwizard": "*", - "menatwork/contao-multicolumnwizard": ">=3.3.4 <4.0" - }, - "autoload": { - "psr-4": { - "MenAtWork\\MultiColumnWizardBundle\\": "src", - "MenAtWork\\MultiColumnWizard\\": "legacy_layer/psr-4-maw", - "MultiColumnWizard\\": "legacy_layer/psr-4-mcw" - }, - "classmap": [ - "legacy_layer/classmap" - ], - "files": [ - "src/deprecated-autoload.php" - ] - }, - "autoload-dev": { - "psr-4": { - "MenAtWork\\MultiColumnWizardBundle\\Test\\": "tests" - }, - "files": [ - "tests/contao3-autoloader.php" - ] - }, - "config": { - "allow-plugins": { - "contao-components/installer": false, - "contao/manager-plugin": false - } - }, - "extra": { - "branch-alias": { - "dev-develop": "3.6.x-dev", - "dev-master": "3.5.x-dev", - "dev-support/contao3": "3.3.x-dev", - "dev-support/contao4.4": "3.4.x-dev" - }, - "contao-manager-plugin": "MenAtWork\\MultiColumnWizardBundle\\ContaoManager\\Plugin" - } -} +{ + "name": "menatwork/contao-multicolumnwizard-bundle", + "description": "MultiColumWizard for Contao OpenSource CMS", + "license": "LGPL-3.0-or-later", + "type": "contao-bundle", + "keywords": [ + "contao", + "widget", + "wizard" + ], + "authors": [ + { + "name": "Stefan Heimes", + "email": "stefan_heimes@hotmail.com", + "homepage": "https://www.men-at-work.de", + "role": "Developer" + }, + { + "name": "Andreas Isaak", + "email": "contao@men-at-work.de", + "homepage": "https://www.men-at-work.de", + "role": "Developer" + }, + { + "name": "David Maack", + "email": "contao@men-at-work.de", + "homepage": "https://www.men-at-work.de", + "role": "Developer" + }, + { + "name": "Andreas Schempp", + "email": "andreas.schempp@terminal42.ch", + "homepage": "https://www.terminal42.ch", + "role": "Developer" + }, + { + "name": "Yanick Witschi", + "email": "yanick.witschi@terminal42.ch", + "homepage": "https://www.terminal42.ch", + "role": "Developer" + }, + { + "name": "Tristan Lins", + "homepage": "https://github.com/tristanlins", + "role": "Developer" + } + ], + "homepage": "https://www.men-at-work.de", + "support": { + "issues": "https://github.com/menatwork/MultiColumnWizard/issues", + "wiki": "https://de.contaowiki.org/MultiColumnWizard", + "irc": "irc://irc.freenode.org/contao.dev", + "source": "https://github.com/menatwork/MultiColumnWizard" + }, + "require": { + "php": "^8.1", + "ext-json": "*", + "contao/core-bundle": "^4.13 || ^5.0", + "symfony/config": "^5.4 || ^6.0", + "symfony/console": "^5.4 || ^6.0", + "symfony/dependency-injection": "^5.4 || ^6.0", + "symfony/event-dispatcher": "^5.4 || ^6.0", + "symfony/http-foundation": "^5.4 || ^6.0", + "symfony/http-kernel": "^5.4 || ^6.0", + "symfony/translation": "^5.4 || ^6.0" + }, + "require-dev": { + "contao/manager-plugin": "^2.1", + "phpcq/runner-bootstrap": "^1.0@dev", + "roave/security-advisories": "dev-latest" + }, + "replace": { + "contao-legacy/multicolumnwizard": "*", + "menatwork/contao-multicolumnwizard": ">=3.3.4 <4.0" + }, + "autoload": { + "psr-4": { + "MenAtWork\\MultiColumnWizardBundle\\": "src", + "MenAtWork\\MultiColumnWizard\\": "legacy_layer/psr-4-maw", + "MultiColumnWizard\\": "legacy_layer/psr-4-mcw" + }, + "classmap": [ + "legacy_layer/classmap" + ], + "files": [ + "src/deprecated-autoload.php" + ] + }, + "autoload-dev": { + "psr-4": { + "MenAtWork\\MultiColumnWizardBundle\\Test\\": "tests" + }, + "files": [ + "tests/contao3-autoloader.php" + ] + }, + "config": { + "allow-plugins": { + "contao-components/installer": false, + "contao/manager-plugin": false, + "php-http/discovery": false + } + }, + "extra": { + "branch-alias": { + "dev-develop": "3.6.x-dev", + "dev-master": "3.5.x-dev", + "dev-support/contao3": "3.3.x-dev", + "dev-support/contao4.4": "3.4.x-dev" + }, + "contao-manager-plugin": "MenAtWork\\MultiColumnWizardBundle\\ContaoManager\\Plugin" + } +} diff --git a/src/Contao/Widgets/MultiColumnWizard.php b/src/Contao/Widgets/MultiColumnWizard.php index a75fae3..9876a16 100644 --- a/src/Contao/Widgets/MultiColumnWizard.php +++ b/src/Contao/Widgets/MultiColumnWizard.php @@ -1148,7 +1148,8 @@ protected function initializeWidget(&$arrField, $intRow, $strKey, $varValue) } } - $strClass = $GLOBALS[($this->contaoApi->isBackend() ? 'BE_FFL' : 'TL_FFL')][$arrField['inputType'] ?? null] ?? null; + $widgetMode = ($this->contaoApi->isBackend() ? 'BE_FFL' : 'TL_FFL'); + $strClass = $GLOBALS[$widgetMode][$arrField['inputType'] ?? null] ?? null; if (empty($strClass) || !class_exists($strClass)) { return null; diff --git a/src/EventListener/Contao/InitializeSystem.php b/src/EventListener/Contao/InitializeSystem.php index 30910fc..050934a 100644 --- a/src/EventListener/Contao/InitializeSystem.php +++ b/src/EventListener/Contao/InitializeSystem.php @@ -50,6 +50,8 @@ public function __construct(ContaoApiService $contaoApi) * Check the scope and add some more information. * * @return void + * + * @SuppressWarnings(PHPMD.Superglobals) */ public function addSystemNecessaryThings(): void { diff --git a/src/Resources/contao/config/config.php b/src/Resources/contao/config/config.php index fb603e6..1510998 100644 --- a/src/Resources/contao/config/config.php +++ b/src/Resources/contao/config/config.php @@ -42,4 +42,4 @@ /* * All Hooks for the BE are moved to the following function: * \MenAtWork\MultiColumnWizardBundle\EventListener\Contao\InitializeSystem::addSystemNecessaryThings - */ \ No newline at end of file + */ diff --git a/src/Service/ContaoApiService.php b/src/Service/ContaoApiService.php index 64a7938..094252d 100644 --- a/src/Service/ContaoApiService.php +++ b/src/Service/ContaoApiService.php @@ -77,4 +77,4 @@ public function getContaoVersion(): ?string { return InstalledVersions::getPrettyVersion('contao/core-bundle'); } -} \ No newline at end of file +} diff --git a/tests/DeprecatedAutoloaderTest.php b/tests/DeprecatedAutoloaderTest.php index 41a0d42..7b50fb6 100644 --- a/tests/DeprecatedAutoloaderTest.php +++ b/tests/DeprecatedAutoloaderTest.php @@ -25,6 +25,7 @@ use Contao\System; use MenAtWork\MultiColumnWizardBundle\Contao\Widgets\MultiColumnWizard as MultiColumnWizardBundle; use MenAtWork\MultiColumnWizardBundle\Contao\Widgets\MultiColumnWizard; +use MenAtWork\MultiColumnWizardBundle\Service\ContaoApiService; use MenAtWork\MultiColumnWizardBundle\Test\Fixture\Issue39Fixture; use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -98,6 +99,15 @@ public function testIssue39() $locator = $this->getMockBuilder(\stdClass::class)->setMethods(['locate'])->getMock(); $locator->method('locate')->willReturn([]); return $locator; + case ContaoApiService::class: + $contaoService = $this + ->getMockBuilder(ContaoApiService::class) + ->disableOriginalConstructor() + ->getMock(); + $contaoService->method('isBackend')->willReturn(true); + $contaoService->method('isFrontend')->willReturn(false); + $contaoService->method('getContaoVersion')->willReturn('3.9.0'); + return $contaoService; case 'event_dispatcher': default: return null; From 470fcfbe2120b3d9a8d388bf44b13cad062449e0 Mon Sep 17 00:00:00 2001 From: Stefan Heimes Date: Sun, 19 Mar 2023 22:35:10 +0100 Subject: [PATCH 48/59] Correct the composer.json --- composer.json | 114 +------------------------------------------------- 1 file changed, 1 insertion(+), 113 deletions(-) diff --git a/composer.json b/composer.json index 1c03e8c..d4b4d58 100644 --- a/composer.json +++ b/composer.json @@ -1,113 +1 @@ -{ - "name": "menatwork/contao-multicolumnwizard-bundle", - "description": "MultiColumWizard for Contao OpenSource CMS", - "license": "LGPL-3.0-or-later", - "type": "contao-bundle", - "keywords": [ - "contao", - "widget", - "wizard" - ], - "authors": [ - { - "name": "Stefan Heimes", - "email": "stefan_heimes@hotmail.com", - "homepage": "https://www.men-at-work.de", - "role": "Developer" - }, - { - "name": "Andreas Isaak", - "email": "contao@men-at-work.de", - "homepage": "https://www.men-at-work.de", - "role": "Developer" - }, - { - "name": "David Maack", - "email": "contao@men-at-work.de", - "homepage": "https://www.men-at-work.de", - "role": "Developer" - }, - { - "name": "Andreas Schempp", - "email": "andreas.schempp@terminal42.ch", - "homepage": "https://www.terminal42.ch", - "role": "Developer" - }, - { - "name": "Yanick Witschi", - "email": "yanick.witschi@terminal42.ch", - "homepage": "https://www.terminal42.ch", - "role": "Developer" - }, - { - "name": "Tristan Lins", - "homepage": "https://github.com/tristanlins", - "role": "Developer" - } - ], - "homepage": "https://www.men-at-work.de", - "support": { - "issues": "https://github.com/menatwork/MultiColumnWizard/issues", - "wiki": "https://de.contaowiki.org/MultiColumnWizard", - "irc": "irc://irc.freenode.org/contao.dev", - "source": "https://github.com/menatwork/MultiColumnWizard" - }, - "require": { - "php": "^8.1", - "ext-json": "*", - "contao/core-bundle": "^4.13 || ^5.0", - "symfony/config": "^5.4 || ^6.0", - "symfony/console": "^5.4 || ^6.0", - "symfony/dependency-injection": "^5.4 || ^6.0", - "symfony/event-dispatcher": "^5.4 || ^6.0", - "symfony/http-foundation": "^5.4 || ^6.0", - "symfony/http-kernel": "^5.4 || ^6.0", - "symfony/translation": "^5.4 || ^6.0" - }, - "require-dev": { - "contao/manager-plugin": "^2.1", - "phpcq/runner-bootstrap": "^1.0@dev", - "roave/security-advisories": "dev-latest" - }, - "replace": { - "contao-legacy/multicolumnwizard": "*", - "menatwork/contao-multicolumnwizard": ">=3.3.4 <4.0" - }, - "autoload": { - "psr-4": { - "MenAtWork\\MultiColumnWizardBundle\\": "src", - "MenAtWork\\MultiColumnWizard\\": "legacy_layer/psr-4-maw", - "MultiColumnWizard\\": "legacy_layer/psr-4-mcw" - }, - "classmap": [ - "legacy_layer/classmap" - ], - "files": [ - "src/deprecated-autoload.php" - ] - }, - "autoload-dev": { - "psr-4": { - "MenAtWork\\MultiColumnWizardBundle\\Test\\": "tests" - }, - "files": [ - "tests/contao3-autoloader.php" - ] - }, - "config": { - "allow-plugins": { - "contao-components/installer": false, - "contao/manager-plugin": false, - "php-http/discovery": false - } - }, - "extra": { - "branch-alias": { - "dev-develop": "3.6.x-dev", - "dev-master": "3.5.x-dev", - "dev-support/contao3": "3.3.x-dev", - "dev-support/contao4.4": "3.4.x-dev" - }, - "contao-manager-plugin": "MenAtWork\\MultiColumnWizardBundle\\ContaoManager\\Plugin" - } -} +{ "name": "menatwork/contao-multicolumnwizard-bundle", "description": "MultiColumWizard for Contao OpenSource CMS", "license": "LGPL-3.0-or-later", "type": "contao-bundle", "keywords": [ "contao", "widget", "wizard" ], "authors": [ { "name": "Stefan Heimes", "email": "stefan_heimes@hotmail.com", "homepage": "https://www.men-at-work.de", "role": "Developer" }, { "name": "Andreas Isaak", "email": "contao@men-at-work.de", "homepage": "https://www.men-at-work.de", "role": "Developer" }, { "name": "David Maack", "email": "contao@men-at-work.de", "homepage": "https://www.men-at-work.de", "role": "Developer" }, { "name": "Andreas Schempp", "email": "andreas.schempp@terminal42.ch", "homepage": "https://www.terminal42.ch", "role": "Developer" }, { "name": "Yanick Witschi", "email": "yanick.witschi@terminal42.ch", "homepage": "https://www.terminal42.ch", "role": "Developer" }, { "name": "Tristan Lins", "homepage": "https://github.com/tristanlins", "role": "Developer" } ], "homepage": "https://www.men-at-work.de", "support": { "issues": "https://github.com/menatwork/MultiColumnWizard/issues", "wiki": "https://de.contaowiki.org/MultiColumnWizard", "irc": "irc://irc.freenode.org/contao.dev", "source": "https://github.com/menatwork/MultiColumnWizard" }, "require": { "php": "^8.1", "ext-json": "*", "contao/core-bundle": "^4.13 || ^5.0", "symfony/config": "^5.4 || ^6.0", "symfony/console": "^5.4 || ^6.0", "symfony/dependency-injection": "^5.4 || ^6.0", "symfony/event-dispatcher": "^5.4 || ^6.0", "symfony/http-foundation": "^5.4 || ^6.0", "symfony/http-kernel": "^5.4 || ^6.0", "symfony/translation": "^5.4 || ^6.0" }, "require-dev": { "contao/manager-plugin": "^2.1", "phpcq/runner-bootstrap": "^1.0@dev", "roave/security-advisories": "dev-latest" }, "replace": { "contao-legacy/multicolumnwizard": "*", "menatwork/contao-multicolumnwizard": ">=3.3.4 <4.0" }, "autoload": { "psr-4": { "MenAtWork\\MultiColumnWizardBundle\\": "src", "MenAtWork\\MultiColumnWizard\\": "legacy_layer/psr-4-maw", "MultiColumnWizard\\": "legacy_layer/psr-4-mcw" }, "classmap": [ "legacy_layer/classmap" ], "files": [ "src/deprecated-autoload.php" ] }, "autoload-dev": { "psr-4": { "MenAtWork\\MultiColumnWizardBundle\\Test\\": "tests" }, "files": [ "tests/contao3-autoloader.php" ] }, "config": { "allow-plugins": { "contao-components/installer": false, "contao/manager-plugin": false, "php-http/discovery": false } }, "extra": { "branch-alias": { "dev-develop": "3.6.x-dev", "dev-master": "3.5.x-dev", "dev-support/contao3": "3.3.x-dev", "dev-support/contao4.4": "3.4.x-dev" }, "contao-manager-plugin": "MenAtWork\\MultiColumnWizardBundle\\ContaoManager\\Plugin" } } \ No newline at end of file From 53d8d280e42cfa12deb69153df31d10f60f0e02e Mon Sep 17 00:00:00 2001 From: Stefan Heimes Date: Sun, 19 Mar 2023 22:36:06 +0100 Subject: [PATCH 49/59] Correct line endings for the composer.json --- composer.json | 114 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 113 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d4b4d58..bda0e84 100644 --- a/composer.json +++ b/composer.json @@ -1 +1,113 @@ -{ "name": "menatwork/contao-multicolumnwizard-bundle", "description": "MultiColumWizard for Contao OpenSource CMS", "license": "LGPL-3.0-or-later", "type": "contao-bundle", "keywords": [ "contao", "widget", "wizard" ], "authors": [ { "name": "Stefan Heimes", "email": "stefan_heimes@hotmail.com", "homepage": "https://www.men-at-work.de", "role": "Developer" }, { "name": "Andreas Isaak", "email": "contao@men-at-work.de", "homepage": "https://www.men-at-work.de", "role": "Developer" }, { "name": "David Maack", "email": "contao@men-at-work.de", "homepage": "https://www.men-at-work.de", "role": "Developer" }, { "name": "Andreas Schempp", "email": "andreas.schempp@terminal42.ch", "homepage": "https://www.terminal42.ch", "role": "Developer" }, { "name": "Yanick Witschi", "email": "yanick.witschi@terminal42.ch", "homepage": "https://www.terminal42.ch", "role": "Developer" }, { "name": "Tristan Lins", "homepage": "https://github.com/tristanlins", "role": "Developer" } ], "homepage": "https://www.men-at-work.de", "support": { "issues": "https://github.com/menatwork/MultiColumnWizard/issues", "wiki": "https://de.contaowiki.org/MultiColumnWizard", "irc": "irc://irc.freenode.org/contao.dev", "source": "https://github.com/menatwork/MultiColumnWizard" }, "require": { "php": "^8.1", "ext-json": "*", "contao/core-bundle": "^4.13 || ^5.0", "symfony/config": "^5.4 || ^6.0", "symfony/console": "^5.4 || ^6.0", "symfony/dependency-injection": "^5.4 || ^6.0", "symfony/event-dispatcher": "^5.4 || ^6.0", "symfony/http-foundation": "^5.4 || ^6.0", "symfony/http-kernel": "^5.4 || ^6.0", "symfony/translation": "^5.4 || ^6.0" }, "require-dev": { "contao/manager-plugin": "^2.1", "phpcq/runner-bootstrap": "^1.0@dev", "roave/security-advisories": "dev-latest" }, "replace": { "contao-legacy/multicolumnwizard": "*", "menatwork/contao-multicolumnwizard": ">=3.3.4 <4.0" }, "autoload": { "psr-4": { "MenAtWork\\MultiColumnWizardBundle\\": "src", "MenAtWork\\MultiColumnWizard\\": "legacy_layer/psr-4-maw", "MultiColumnWizard\\": "legacy_layer/psr-4-mcw" }, "classmap": [ "legacy_layer/classmap" ], "files": [ "src/deprecated-autoload.php" ] }, "autoload-dev": { "psr-4": { "MenAtWork\\MultiColumnWizardBundle\\Test\\": "tests" }, "files": [ "tests/contao3-autoloader.php" ] }, "config": { "allow-plugins": { "contao-components/installer": false, "contao/manager-plugin": false, "php-http/discovery": false } }, "extra": { "branch-alias": { "dev-develop": "3.6.x-dev", "dev-master": "3.5.x-dev", "dev-support/contao3": "3.3.x-dev", "dev-support/contao4.4": "3.4.x-dev" }, "contao-manager-plugin": "MenAtWork\\MultiColumnWizardBundle\\ContaoManager\\Plugin" } } \ No newline at end of file +{ + "name": "menatwork/contao-multicolumnwizard-bundle", + "description": "MultiColumWizard for Contao OpenSource CMS", + "license": "LGPL-3.0-or-later", + "type": "contao-bundle", + "keywords": [ + "contao", + "widget", + "wizard" + ], + "authors": [ + { + "name": "Stefan Heimes", + "email": "stefan_heimes@hotmail.com", + "homepage": "https://www.men-at-work.de", + "role": "Developer" + }, + { + "name": "Andreas Isaak", + "email": "contao@men-at-work.de", + "homepage": "https://www.men-at-work.de", + "role": "Developer" + }, + { + "name": "David Maack", + "email": "contao@men-at-work.de", + "homepage": "https://www.men-at-work.de", + "role": "Developer" + }, + { + "name": "Andreas Schempp", + "email": "andreas.schempp@terminal42.ch", + "homepage": "https://www.terminal42.ch", + "role": "Developer" + }, + { + "name": "Yanick Witschi", + "email": "yanick.witschi@terminal42.ch", + "homepage": "https://www.terminal42.ch", + "role": "Developer" + }, + { + "name": "Tristan Lins", + "homepage": "https://github.com/tristanlins", + "role": "Developer" + } + ], + "homepage": "https://www.men-at-work.de", + "support": { + "issues": "https://github.com/menatwork/MultiColumnWizard/issues", + "wiki": "https://de.contaowiki.org/MultiColumnWizard", + "irc": "irc://irc.freenode.org/contao.dev", + "source": "https://github.com/menatwork/MultiColumnWizard" + }, + "require": { + "php": "^8.1", + "ext-json": "*", + "contao/core-bundle": "^4.13 || ^5.0", + "symfony/config": "^5.4 || ^6.0", + "symfony/console": "^5.4 || ^6.0", + "symfony/dependency-injection": "^5.4 || ^6.0", + "symfony/event-dispatcher": "^5.4 || ^6.0", + "symfony/http-foundation": "^5.4 || ^6.0", + "symfony/http-kernel": "^5.4 || ^6.0", + "symfony/translation": "^5.4 || ^6.0" + }, + "require-dev": { + "contao/manager-plugin": "^2.1", + "phpcq/runner-bootstrap": "^1.0@dev", + "roave/security-advisories": "dev-latest" + }, + "replace": { + "contao-legacy/multicolumnwizard": "*", + "menatwork/contao-multicolumnwizard": ">=3.3.4 <4.0" + }, + "autoload": { + "psr-4": { + "MenAtWork\\MultiColumnWizardBundle\\": "src", + "MenAtWork\\MultiColumnWizard\\": "legacy_layer/psr-4-maw", + "MultiColumnWizard\\": "legacy_layer/psr-4-mcw" + }, + "classmap": [ + "legacy_layer/classmap" + ], + "files": [ + "src/deprecated-autoload.php" + ] + }, + "autoload-dev": { + "psr-4": { + "MenAtWork\\MultiColumnWizardBundle\\Test\\": "tests" + }, + "files": [ + "tests/contao3-autoloader.php" + ] + }, + "config": { + "allow-plugins": { + "contao-components/installer": false, + "contao/manager-plugin": false, + "php-http/discovery": false + } + }, + "extra": { + "branch-alias": { + "dev-develop": "3.6.x-dev", + "dev-master": "3.5.x-dev", + "dev-support/contao3": "3.3.x-dev", + "dev-support/contao4.4": "3.4.x-dev" + }, + "contao-manager-plugin": "MenAtWork\\MultiColumnWizardBundle\\ContaoManager\\Plugin" + } +} From 480d0b03a3c741cd1b5fcf5e0dd68af18ede88b6 Mon Sep 17 00:00:00 2001 From: Stefan Heimes Date: Sun, 19 Mar 2023 23:02:06 +0100 Subject: [PATCH 50/59] Update composer.json --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index bda0e84..39e261c 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "role": "Developer" }, { - "name": "Andreas Schempp", + "name": "Andreas Schempp", "email": "andreas.schempp@terminal42.ch", "homepage": "https://www.terminal42.ch", "role": "Developer" @@ -103,8 +103,8 @@ }, "extra": { "branch-alias": { - "dev-develop": "3.6.x-dev", - "dev-master": "3.5.x-dev", + "dev-develop": "3.7.x-dev", + "dev-master": "3.6.x-dev", "dev-support/contao3": "3.3.x-dev", "dev-support/contao4.4": "3.4.x-dev" }, From 40bcd961e27f46eafd97518c331a1eb593314ca2 Mon Sep 17 00:00:00 2001 From: Andreas Schempp Date: Mon, 22 May 2023 08:53:27 +0200 Subject: [PATCH 51/59] Fix PHP warning on initializeSystem --- src/EventListener/Contao/InitializeSystem.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EventListener/Contao/InitializeSystem.php b/src/EventListener/Contao/InitializeSystem.php index 050934a..9f1332d 100644 --- a/src/EventListener/Contao/InitializeSystem.php +++ b/src/EventListener/Contao/InitializeSystem.php @@ -86,7 +86,7 @@ public function changeAjaxPostActions(): void return; } - $name = Input::post('name'); + $name = (string) Input::post('name'); if (!\preg_match('/_row[0-9]*_/i', $name)) { return; } From 755b736db037a3c15ec33649267a3c2bf10a4030 Mon Sep 17 00:00:00 2001 From: e-spin Date: Fri, 28 Jul 2023 20:55:50 +0200 Subject: [PATCH 52/59] Fix PHPCQ2 warnings --- composer.json | 2 +- src/Contao/Widgets/MultiColumnWizard.php | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 39e261c..46a8718 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "role": "Developer" }, { - "name": "Andreas Schempp", + "name": "Andreas Schempp", "email": "andreas.schempp@terminal42.ch", "homepage": "https://www.terminal42.ch", "role": "Developer" diff --git a/src/Contao/Widgets/MultiColumnWizard.php b/src/Contao/Widgets/MultiColumnWizard.php index 9876a16..8552d50 100644 --- a/src/Contao/Widgets/MultiColumnWizard.php +++ b/src/Contao/Widgets/MultiColumnWizard.php @@ -179,8 +179,17 @@ class_alias(self::class, 'MultiColumnWizard'); parent::__construct($arrAttributes); - $this->contaoApi = System::getContainer()->get(ContaoApiService::class); - $this->eventDispatcher = System::getContainer()->get('event_dispatcher'); + $api = System::getContainer()->get(ContaoApiService::class); + if (!$api instanceof ContaoApiService) { + throw new \RuntimeException('Invalid API service.'); + } + $this->contaoApi = $api; + + $dispatcher = System::getContainer()->get('event_dispatcher'); + if (!$dispatcher instanceof EventDispatcherInterface) { + throw new \RuntimeException('Invalid event dispatcher service.'); + } + $this->eventDispatcher = $dispatcher; // Frontend handling. if (!empty($arrAttributes['strTable']) && $this->contaoApi->isFrontend()) { @@ -224,10 +233,12 @@ public function __set($strKey, $varValue) */ if ($this->flatArray) { - $arrNew = array(); + $arrNew = []; + $key = key($this->columnFields); + assert(null !== $key); foreach ($this->varValue as $val) { - $arrNew[] = array(key($this->columnFields) => $val); + $arrNew[] = array($key => $val); } $this->varValue = $arrNew; From be658df9ba26350d954c5bef828275a9e6b235cc Mon Sep 17 00:00:00 2001 From: Stefan Heimes Date: Wed, 2 Aug 2023 21:24:58 +0200 Subject: [PATCH 53/59] Update - Normalize the composer.json - Update the test file --- composer.json | 206 ++++++++++++++--------------- tests/DeprecatedAutoloaderTest.php | 8 ++ 2 files changed, 111 insertions(+), 103 deletions(-) diff --git a/composer.json b/composer.json index 46a8718..ed55aed 100644 --- a/composer.json +++ b/composer.json @@ -1,113 +1,113 @@ { - "name": "menatwork/contao-multicolumnwizard-bundle", - "description": "MultiColumWizard for Contao OpenSource CMS", - "license": "LGPL-3.0-or-later", - "type": "contao-bundle", - "keywords": [ - "contao", - "widget", - "wizard" - ], - "authors": [ - { - "name": "Stefan Heimes", - "email": "stefan_heimes@hotmail.com", - "homepage": "https://www.men-at-work.de", - "role": "Developer" - }, - { - "name": "Andreas Isaak", - "email": "contao@men-at-work.de", - "homepage": "https://www.men-at-work.de", - "role": "Developer" - }, - { - "name": "David Maack", - "email": "contao@men-at-work.de", - "homepage": "https://www.men-at-work.de", - "role": "Developer" - }, - { - "name": "Andreas Schempp", - "email": "andreas.schempp@terminal42.ch", - "homepage": "https://www.terminal42.ch", - "role": "Developer" - }, - { - "name": "Yanick Witschi", - "email": "yanick.witschi@terminal42.ch", - "homepage": "https://www.terminal42.ch", - "role": "Developer" - }, - { - "name": "Tristan Lins", - "homepage": "https://github.com/tristanlins", - "role": "Developer" - } - ], - "homepage": "https://www.men-at-work.de", - "support": { - "issues": "https://github.com/menatwork/MultiColumnWizard/issues", - "wiki": "https://de.contaowiki.org/MultiColumnWizard", - "irc": "irc://irc.freenode.org/contao.dev", - "source": "https://github.com/menatwork/MultiColumnWizard" + "name": "menatwork/contao-multicolumnwizard-bundle", + "description": "MultiColumWizard for Contao OpenSource CMS", + "license": "LGPL-3.0-or-later", + "type": "contao-bundle", + "keywords": [ + "contao", + "widget", + "wizard" + ], + "authors": [ + { + "name": "Stefan Heimes", + "email": "stefan_heimes@hotmail.com", + "homepage": "https://www.men-at-work.de", + "role": "Developer" }, - "require": { - "php": "^8.1", - "ext-json": "*", - "contao/core-bundle": "^4.13 || ^5.0", - "symfony/config": "^5.4 || ^6.0", - "symfony/console": "^5.4 || ^6.0", - "symfony/dependency-injection": "^5.4 || ^6.0", - "symfony/event-dispatcher": "^5.4 || ^6.0", - "symfony/http-foundation": "^5.4 || ^6.0", - "symfony/http-kernel": "^5.4 || ^6.0", - "symfony/translation": "^5.4 || ^6.0" + { + "name": "Andreas Isaak", + "email": "contao@men-at-work.de", + "homepage": "https://www.men-at-work.de", + "role": "Developer" }, - "require-dev": { - "contao/manager-plugin": "^2.1", - "phpcq/runner-bootstrap": "^1.0@dev", - "roave/security-advisories": "dev-latest" + { + "name": "David Maack", + "email": "contao@men-at-work.de", + "homepage": "https://www.men-at-work.de", + "role": "Developer" }, - "replace": { - "contao-legacy/multicolumnwizard": "*", - "menatwork/contao-multicolumnwizard": ">=3.3.4 <4.0" + { + "name": "Andreas Schempp", + "email": "andreas.schempp@terminal42.ch", + "homepage": "https://www.terminal42.ch", + "role": "Developer" }, - "autoload": { - "psr-4": { - "MenAtWork\\MultiColumnWizardBundle\\": "src", - "MenAtWork\\MultiColumnWizard\\": "legacy_layer/psr-4-maw", - "MultiColumnWizard\\": "legacy_layer/psr-4-mcw" - }, - "classmap": [ - "legacy_layer/classmap" - ], - "files": [ - "src/deprecated-autoload.php" - ] + { + "name": "Yanick Witschi", + "email": "yanick.witschi@terminal42.ch", + "homepage": "https://www.terminal42.ch", + "role": "Developer" }, - "autoload-dev": { - "psr-4": { - "MenAtWork\\MultiColumnWizardBundle\\Test\\": "tests" - }, - "files": [ - "tests/contao3-autoloader.php" - ] + { + "name": "Tristan Lins", + "homepage": "https://github.com/tristanlins", + "role": "Developer" + } + ], + "homepage": "https://www.men-at-work.de", + "support": { + "issues": "https://github.com/menatwork/MultiColumnWizard/issues", + "wiki": "https://de.contaowiki.org/MultiColumnWizard", + "irc": "irc://irc.freenode.org/contao.dev", + "source": "https://github.com/menatwork/MultiColumnWizard" + }, + "require": { + "php": "^8.1", + "ext-json": "*", + "contao/core-bundle": "^4.13 || ^5.0", + "symfony/config": "^5.4 || ^6.0", + "symfony/console": "^5.4 || ^6.0", + "symfony/dependency-injection": "^5.4 || ^6.0", + "symfony/event-dispatcher": "^5.4 || ^6.0", + "symfony/http-foundation": "^5.4 || ^6.0", + "symfony/http-kernel": "^5.4 || ^6.0", + "symfony/translation": "^5.4 || ^6.0" + }, + "require-dev": { + "contao/manager-plugin": "^2.1", + "phpcq/runner-bootstrap": "^1.0@dev", + "roave/security-advisories": "dev-latest" + }, + "replace": { + "contao-legacy/multicolumnwizard": "*", + "menatwork/contao-multicolumnwizard": ">=3.3.4 <4.0" + }, + "autoload": { + "psr-4": { + "MenAtWork\\MultiColumnWizardBundle\\": "src", + "MenAtWork\\MultiColumnWizard\\": "legacy_layer/psr-4-maw", + "MultiColumnWizard\\": "legacy_layer/psr-4-mcw" }, - "config": { - "allow-plugins": { - "contao-components/installer": false, - "contao/manager-plugin": false, - "php-http/discovery": false - } + "classmap": [ + "legacy_layer/classmap" + ], + "files": [ + "src/deprecated-autoload.php" + ] + }, + "autoload-dev": { + "psr-4": { + "MenAtWork\\MultiColumnWizardBundle\\Test\\": "tests" }, - "extra": { - "branch-alias": { - "dev-develop": "3.7.x-dev", - "dev-master": "3.6.x-dev", - "dev-support/contao3": "3.3.x-dev", - "dev-support/contao4.4": "3.4.x-dev" - }, - "contao-manager-plugin": "MenAtWork\\MultiColumnWizardBundle\\ContaoManager\\Plugin" + "files": [ + "tests/contao3-autoloader.php" + ] + }, + "config": { + "allow-plugins": { + "contao-components/installer": false, + "contao/manager-plugin": false, + "php-http/discovery": false } + }, + "extra": { + "branch-alias": { + "dev-develop": "3.7.x-dev", + "dev-master": "3.6.x-dev", + "dev-support/contao3": "3.3.x-dev", + "dev-support/contao4.4": "3.4.x-dev" + }, + "contao-manager-plugin": "MenAtWork\\MultiColumnWizardBundle\\ContaoManager\\Plugin" + } } diff --git a/tests/DeprecatedAutoloaderTest.php b/tests/DeprecatedAutoloaderTest.php index 7b50fb6..9b35b91 100644 --- a/tests/DeprecatedAutoloaderTest.php +++ b/tests/DeprecatedAutoloaderTest.php @@ -29,6 +29,7 @@ use MenAtWork\MultiColumnWizardBundle\Test\Fixture\Issue39Fixture; use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\EventDispatcher\EventDispatcher; /** * This class test the overwrite of the older namespace of previous versions. @@ -109,6 +110,13 @@ public function testIssue39() $contaoService->method('getContaoVersion')->willReturn('3.9.0'); return $contaoService; case 'event_dispatcher': + $contaoEventDispatcher = $this + ->getMockBuilder(EventDispatcher::class) + ->disableOriginalConstructor() + ->getMock(); + $contaoEventDispatcher->method('dispatch')->willReturn((object) 'test'); + $contaoEventDispatcher->method('getListeners')->willReturn([]); + return $contaoEventDispatcher; default: return null; } From 45e2f6857644b107163d2c9156bdb93a21a1632d Mon Sep 17 00:00:00 2001 From: Stefan Heimes Date: Wed, 2 Aug 2023 22:11:48 +0200 Subject: [PATCH 54/59] Remove min stability for the diagnostics --- .github/workflows/diagnostics.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/diagnostics.yml b/.github/workflows/diagnostics.yml index e341a7d..6e7f038 100644 --- a/.github/workflows/diagnostics.yml +++ b/.github/workflows/diagnostics.yml @@ -61,9 +61,6 @@ jobs: restore-keys: | ${{ runner.os }}-build-${{ env.cache-name }}- - - name: PHP ${{ matrix.php }} ${{ matrix.contao }} Setup composer config - run: composer config minimum-stability dev - - name: PHP ${{ matrix.php }} ${{ matrix.contao }} Install composer dependencies run: composer update --no-interaction --no-progress --no-suggest --prefer-dist --prefer-stable From 0ef4c3c599e0349ae7e1204c91170a7ce9f4622b Mon Sep 17 00:00:00 2001 From: Stefan Heimes Date: Wed, 2 Aug 2023 22:14:52 +0200 Subject: [PATCH 55/59] Update the phpcq.lock --- .phpcq.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.phpcq.lock b/.phpcq.lock index ff8adb5..e709961 100644 --- a/.phpcq.lock +++ b/.phpcq.lock @@ -1 +1 @@ -{"plugins":{"phpunit":{"api-version":"1.0.0","version":"1.0.0.0","type":"php-file","url":"https://phpcq.github.io/repository/phpunit-1.0.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0"},"tool":{"phpunit":"^6.0 || ^7.0 || ^8.0 || ^9.0"}},"checksum":{"type":"sha-512","value":"c73f15658e3ba62665f09492ec91c3a6a715760bfaa88473a987538439fff442540148e086e46a6aa18ce55a3ea2fbf76caaa581384cb84a38859fcc609ae7e4"},"tools":{"phpunit":{"version":"9.5.20","url":"https://phar.phpunit.de/phpunit-9.5.20.phar","requirements":{"php":{"php":">=7.3","ext-dom":"*","ext-json":"*","ext-libxml":"*","ext-mbstring":"*","ext-xml":"*","ext-xmlwriter":"*"}},"checksum":{"type":"sha-256","value":"6becad2da5c37f5ad101cc665ef05a2f1a6a45d2427c8edcc74f72c92fb1e05a"},"signature":"https://phar.phpunit.de/phpunit-9.5.20.phar.asc"}},"composerLock":null},"composer-require-checker":{"api-version":"1.0.0","version":"1.0.1.0","type":"php-file","url":"https://phpcq.github.io/repository/composer-require-checker-1.0.1.0.php","signature":null,"requirements":{"php":{"php":"^7.4 || ^8.0"},"tool":{"composer-require-checker":"^3.8"}},"checksum":{"type":"sha-512","value":"5b0fd8cd5e0f5761c53b9d5375b6f6ba50f148468896248f823cc2a48361adfd872556066764b1b544ff51ffd5de60d6f9a75050db00b257d807976ac761bc3a"},"tools":{"composer-require-checker":{"version":"3.8.0","url":"https://github.com/maglnet/ComposerRequireChecker/releases/download/3.8.0/composer-require-checker.phar","requirements":{"php":{"php":"^7.4 || ^8.0","ext-json":"*","ext-phar":"*"}},"checksum":null,"signature":"https://github.com/maglnet/ComposerRequireChecker/releases/download/3.8.0/composer-require-checker.phar.asc"}},"composerLock":null},"phpmd":{"api-version":"1.0.0","version":"1.0.1.0","type":"php-file","url":"https://phpcq.github.io/repository/phpmd-1.0.1.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpmd":"^2.6.1"}},"checksum":{"type":"sha-512","value":"88e267b9c36b2edc85e924717606b626e005ac8d97b1f65f5331e2a3b3894dec2cf124f6187541bf759d026477b6d94daacc5d5c81bb09714a68ffabe5698dc5"},"tools":{"phpmd":{"version":"2.12.0","url":"https://github.com/phpmd/phpmd/releases/download/2.12.0/phpmd.phar","requirements":{"php":{"php":">=5.3.9","ext-xml":"*"}},"checksum":null,"signature":null}},"composerLock":null},"phpcpd":{"api-version":"1.0.0","version":"1.1.1.0","type":"php-file","url":"https://phpcq.github.io/repository/phpcpd-1.1.1.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpcpd":"^6.0"}},"checksum":{"type":"sha-512","value":"1189ce0bf3fade4cb4241f1d96f915ef8fc7651f4450dc79fdf464ee3d6be3009316f0d423ce2d4af9d76ad50807b7fdf4d77bfa6d9ee2c91d6eda32ea214433"},"tools":{"phpcpd":{"version":"6.0.3","url":"https://phar.phpunit.de/phpcpd-6.0.3.phar","requirements":{"php":{"php":">=7.3","ext-dom":"*"}},"checksum":{"type":"sha-256","value":"2cbaea7cfda1bb4299d863eb075e977c3f49055dd16d88529fae5150d48a84cb"},"signature":"https://phar.phpunit.de/phpcpd-6.0.3.phar.asc"}},"composerLock":null},"phploc":{"api-version":"1.0.0","version":"1.0.0.0","type":"php-file","url":"https://phpcq.github.io/repository/phploc-1.0.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*","ext-json":"*"},"tool":{"phploc":"^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0"}},"checksum":{"type":"sha-512","value":"f67b02d494796adf553cb3dd13ec06c1cb8e53c799954061749424251379541637538199afb3afa3c7a01cabd1cb6f1c53eb621f015dff9644c6c7cbf10c56d1"},"tools":{"phploc":{"version":"7.0.2","url":"https://phar.phpunit.de/phploc-7.0.2.phar","requirements":{"php":{"php":">=7.3","ext-dom":"*","ext-json":"*"}},"checksum":{"type":"sha-256","value":"3d59778ec86faf25fd00e3a329b2f9ad4a3c751ca91601ea7dab70f887b0bf46"},"signature":"https://phar.phpunit.de/phploc-7.0.2.phar.asc"}},"composerLock":null},"phpcs":{"api-version":"1.0.0","version":"1.1.0.0","type":"php-file","url":"https://phpcq.github.io/repository/phpcs-1.1.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpcs":"^3.0 || ^2.0","phpcbf":"^3.0 || ^2.0"}},"checksum":{"type":"sha-512","value":"2737022369da1318cc4e0ea194e8a81019f7b079080d869aab878b7486052fdbe68fee3f28131f35573226def1aabd4bd005e038ee7b767c137b1107c1492a83"},"tools":{"phpcs":{"version":"3.6.2","url":"https://github.com/squizlabs/PHP_CodeSniffer/releases/download/3.6.2/phpcs.phar","requirements":{"php":{"php":">=5.4.0","ext-tokenizer":"*","ext-xmlwriter":"*","ext-simplexml":"*"}},"checksum":null,"signature":"https://github.com/squizlabs/PHP_CodeSniffer/releases/download/3.6.2/phpcs.phar.asc"},"phpcbf":{"version":"3.6.2","url":"https://github.com/squizlabs/PHP_CodeSniffer/releases/download/3.6.2/phpcbf.phar","requirements":{"php":{"php":">=5.4.0","ext-tokenizer":"*","ext-xmlwriter":"*","ext-simplexml":"*"}},"checksum":null,"signature":"https://github.com/squizlabs/PHP_CodeSniffer/releases/download/3.6.2/phpcbf.phar.asc"}},"composerLock":null},"composer-normalize":{"api-version":"1.0.0","version":"1.1.0.0","type":"php-file","url":"https://phpcq.github.io/repository/composer-normalize-1.1.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-json":"*"},"tool":{"composer-normalize":"^2.1"}},"checksum":{"type":"sha-512","value":"d59d3557cb20630734878a9115df5dd32d5aff815e5b15be36f6fb5d6e9d83dd36efd84215ab6529edcc924f600946f739a0d9e67723deff95c88346ab502498"},"tools":{"composer-normalize":{"version":"2.25.1","url":"https://github.com/ergebnis/composer-normalize/releases/download/2.25.1/composer-normalize.phar","requirements":{"php":{"php":"^7.4 || ^8.0"}},"checksum":null,"signature":"https://github.com/ergebnis/composer-normalize/releases/download/2.25.1/composer-normalize.phar.asc"}},"composerLock":null}},"tools":[]} \ No newline at end of file +{"plugins":{"phpunit":{"api-version":"1.0.0","version":"1.0.0.0","type":"php-file","url":"https://phpcq.github.io/repository/phpunit-1.0.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0"},"tool":{"phpunit":"^6.0 || ^7.0 || ^8.0 || ^9.0"}},"checksum":{"type":"sha-512","value":"c73f15658e3ba62665f09492ec91c3a6a715760bfaa88473a987538439fff442540148e086e46a6aa18ce55a3ea2fbf76caaa581384cb84a38859fcc609ae7e4"},"tools":{"phpunit":{"version":"9.6.10","url":"https://phar.phpunit.de/phpunit-9.6.10.phar","requirements":{"php":{"php":">=7.3","ext-dom":"*","ext-json":"*","ext-libxml":"*","ext-mbstring":"*","ext-xml":"*","ext-xmlwriter":"*"}},"checksum":{"type":"sha-256","value":"81fc7b66061dcce44ed1b093af0484b17b90fba5b058bad033a2417a9c9a565d"},"signature":"https://phar.phpunit.de/phpunit-9.6.10.phar.asc"}},"composerLock":null},"composer-require-checker":{"api-version":"1.0.0","version":"1.1.1.0","type":"php-file","url":"https://phpcq.github.io/repository/composer-require-checker-1.1.1.0.php","signature":null,"requirements":{"php":{"php":"^7.4 || ^8.0"},"tool":{"composer-require-checker":"^3.8 || ^4.0"}},"checksum":{"type":"sha-512","value":"d5415bddfe024c5749d894034583882aee4e5c3e1087815d9fdd81cb5e71630f631a0e35de0ff84b97fbbf738c16ece5f83bd8c00695913eb846aa6f04577dc2"},"tools":{"composer-require-checker":{"version":"3.8.0","url":"https://github.com/maglnet/ComposerRequireChecker/releases/download/3.8.0/composer-require-checker.phar","requirements":{"php":{"php":"^7.4 || ^8.0","ext-json":"*","ext-phar":"*"}},"checksum":null,"signature":"https://github.com/maglnet/ComposerRequireChecker/releases/download/3.8.0/composer-require-checker.phar.asc"}},"composerLock":null},"phpmd":{"api-version":"1.0.0","version":"1.0.2.0","type":"php-file","url":"https://phpcq.github.io/repository/phpmd-1.0.2.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpmd":"^2.6.1"}},"checksum":{"type":"sha-512","value":"f22280a6dec8dbdd2ec1d83b294f23237fe32c34f4a298e52038e0a7a0074d541635b2b488b1a6098a42d8418a6cd8eb804406ea82b91e362be2b5d11a0915b0"},"tools":{"phpmd":{"version":"2.13.0","url":"https://github.com/phpmd/phpmd/releases/download/2.13.0/phpmd.phar","requirements":{"php":{"php":">=5.3.9","ext-xml":"*"}},"checksum":null,"signature":"https://github.com/phpmd/phpmd/releases/download/2.13.0/phpmd.phar.asc"}},"composerLock":null},"phpcpd":{"api-version":"1.0.0","version":"1.1.1.0","type":"php-file","url":"https://phpcq.github.io/repository/phpcpd-1.1.1.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpcpd":"^6.0"}},"checksum":{"type":"sha-512","value":"1189ce0bf3fade4cb4241f1d96f915ef8fc7651f4450dc79fdf464ee3d6be3009316f0d423ce2d4af9d76ad50807b7fdf4d77bfa6d9ee2c91d6eda32ea214433"},"tools":{"phpcpd":{"version":"6.0.3","url":"https://phar.phpunit.de/phpcpd-6.0.3.phar","requirements":{"php":{"php":">=7.3","ext-dom":"*"}},"checksum":{"type":"sha-256","value":"2cbaea7cfda1bb4299d863eb075e977c3f49055dd16d88529fae5150d48a84cb"},"signature":"https://phar.phpunit.de/phpcpd-6.0.3.phar.asc"}},"composerLock":null},"phploc":{"api-version":"1.0.0","version":"1.0.0.0","type":"php-file","url":"https://phpcq.github.io/repository/phploc-1.0.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*","ext-json":"*"},"tool":{"phploc":"^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0"}},"checksum":{"type":"sha-512","value":"f67b02d494796adf553cb3dd13ec06c1cb8e53c799954061749424251379541637538199afb3afa3c7a01cabd1cb6f1c53eb621f015dff9644c6c7cbf10c56d1"},"tools":{"phploc":{"version":"7.0.2","url":"https://phar.phpunit.de/phploc-7.0.2.phar","requirements":{"php":{"php":">=7.3","ext-dom":"*","ext-json":"*"}},"checksum":{"type":"sha-256","value":"3d59778ec86faf25fd00e3a329b2f9ad4a3c751ca91601ea7dab70f887b0bf46"},"signature":"https://phar.phpunit.de/phploc-7.0.2.phar.asc"}},"composerLock":null},"phpcs":{"api-version":"1.0.0","version":"1.1.0.0","type":"php-file","url":"https://phpcq.github.io/repository/phpcs-1.1.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpcs":"^3.0 || ^2.0","phpcbf":"^3.0 || ^2.0"}},"checksum":{"type":"sha-512","value":"2737022369da1318cc4e0ea194e8a81019f7b079080d869aab878b7486052fdbe68fee3f28131f35573226def1aabd4bd005e038ee7b767c137b1107c1492a83"},"tools":{"phpcs":{"version":"3.7.2","url":"https://github.com/squizlabs/PHP_CodeSniffer/releases/download/3.7.2/phpcs.phar","requirements":{"php":{"php":">=5.4.0","ext-tokenizer":"*","ext-xmlwriter":"*","ext-simplexml":"*"}},"checksum":null,"signature":"https://github.com/squizlabs/PHP_CodeSniffer/releases/download/3.7.2/phpcs.phar.asc"},"phpcbf":{"version":"3.7.2","url":"https://github.com/squizlabs/PHP_CodeSniffer/releases/download/3.7.2/phpcbf.phar","requirements":{"php":{"php":">=5.4.0","ext-tokenizer":"*","ext-xmlwriter":"*","ext-simplexml":"*"}},"checksum":null,"signature":"https://github.com/squizlabs/PHP_CodeSniffer/releases/download/3.7.2/phpcbf.phar.asc"}},"composerLock":null},"composer-normalize":{"api-version":"1.0.0","version":"1.1.0.0","type":"php-file","url":"https://phpcq.github.io/repository/composer-normalize-1.1.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-json":"*"},"tool":{"composer-normalize":"^2.1"}},"checksum":{"type":"sha-512","value":"d59d3557cb20630734878a9115df5dd32d5aff815e5b15be36f6fb5d6e9d83dd36efd84215ab6529edcc924f600946f739a0d9e67723deff95c88346ab502498"},"tools":{"composer-normalize":{"version":"2.34.0","url":"https://github.com/ergebnis/composer-normalize/releases/download/2.34.0/composer-normalize.phar","requirements":{"php":{"php":"~8.1.0 || ~8.2.0","ext-json":"*"}},"checksum":null,"signature":"https://github.com/ergebnis/composer-normalize/releases/download/2.34.0/composer-normalize.phar.asc"}},"composerLock":null}},"tools":[]} \ No newline at end of file From e9679cf0725259ee99f45e9e06b954660d0f1673 Mon Sep 17 00:00:00 2001 From: Stefan Heimes Date: Wed, 2 Aug 2023 22:22:14 +0200 Subject: [PATCH 56/59] Update the actions/checkout to version 3 --- .github/workflows/diagnostics.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/diagnostics.yml b/.github/workflows/diagnostics.yml index 6e7f038..07fa91c 100644 --- a/.github/workflows/diagnostics.yml +++ b/.github/workflows/diagnostics.yml @@ -32,7 +32,7 @@ jobs: steps: - name: PHP ${{ matrix.php }} ${{ matrix.contao }} Pull source - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 From 3baba1bb7599eb4e147453aa4b527376bfa9a35c Mon Sep 17 00:00:00 2001 From: zonky2 Date: Mon, 20 Nov 2023 17:20:30 +0100 Subject: [PATCH 57/59] Fix label value ist array --- src/EventListener/DcGeneral/UpdateDataDefinition.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/EventListener/DcGeneral/UpdateDataDefinition.php b/src/EventListener/DcGeneral/UpdateDataDefinition.php index 8e01aa9..6b83e2b 100644 --- a/src/EventListener/DcGeneral/UpdateDataDefinition.php +++ b/src/EventListener/DcGeneral/UpdateDataDefinition.php @@ -3,7 +3,7 @@ /** * This file is part of menatwork/contao-multicolumnwizard-bundle. * - * (c) 2012-2019 MEN AT WORK. + * (c) 2012-2023 MEN AT WORK. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -14,9 +14,10 @@ * @author Christian Schiffler * @author Stefan Heimes * @author Sven Baumann + * @author Ingolf Steinhardt * @copyright 2011 Andreas Schempp * @copyright 2011 certo web & design GmbH - * @copyright 2013-2019 MEN AT WORK + * @copyright 2013-2023 MEN AT WORK * @license https://github.com/menatwork/contao-multicolumnwizard-bundle/blob/master/LICENSE LGPL-3.0-or-later * @filesource */ @@ -93,6 +94,11 @@ private function addPropertyToDefinition( foreach ($fieldConfig as $key => $value) { switch ($key) { case 'label': + if (is_array($value)) { + $subProperty->setLabel(reset($value)); + $subProperty->setDescription(next($value)); + break; + } $subProperty->setLabel($value); break; From 4a559e4ea092589f4f930e0d9c6cf93781202173 Mon Sep 17 00:00:00 2001 From: e-spin Date: Wed, 14 Feb 2024 15:33:39 +0100 Subject: [PATCH 58/59] Set options array to nullable for check if options set. --- src/Event/GetOptionsEvent.php | 45 ++++++++++++++++------------------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/src/Event/GetOptionsEvent.php b/src/Event/GetOptionsEvent.php index d9c532a..2a2bfee 100644 --- a/src/Event/GetOptionsEvent.php +++ b/src/Event/GetOptionsEvent.php @@ -3,7 +3,7 @@ /** * This file is part of menatwork/contao-multicolumnwizard-bundle. * - * (c) 2012-2019 MEN AT WORK. + * (c) 2012-2024 MEN AT WORK. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -14,9 +14,10 @@ * @author Christian Schiffler * @author Stefan Heimes * @author Fritz Michael Gschwantner + * @author Ingolf Steinhardt * @copyright 2011 Andreas Schempp * @copyright 2011 certo web & design GmbH - * @copyright 2013-2019 MEN AT WORK + * @copyright 2013-2024 MEN AT WORK * @license https://github.com/menatwork/contao-multicolumnwizard-bundle/blob/master/LICENSE LGPL-3.0-or-later * @filesource */ @@ -26,6 +27,7 @@ use ContaoCommunityAlliance\DcGeneral\Data\ModelInterface; use ContaoCommunityAlliance\DcGeneral\EnvironmentInterface; use MenAtWork\MultiColumnWizardBundle\Contao\Widgets\MultiColumnWizard as BundleMultiColumnWizard; +use MultiColumnWizard; use Symfony\Contracts\EventDispatcher\Event; /** @@ -39,7 +41,7 @@ class GetOptionsEvent extends Event public const NAME = 'men-at-work.multi-column-wizard-bundle.get-options'; /** - * The name of the multi column wizard. + * The name of the multi-column wizard. * * @var string */ @@ -67,33 +69,28 @@ class GetOptionsEvent extends Event protected $model; /** - * The multi column wizard. + * The multi-column wizard. * - * @var \MultiColumnWizard + * @var MultiColumnWizard */ protected $widget; /** * The options array. * - * @var array + * @var array|null */ protected $options; /** * Create a new instance. * - * @param string $propertyName The name of the multi column wizard widget. - * - * @param string $subPropertyName The name of the sub widget. - * - * @param EnvironmentInterface $environment The environment instance. - * - * @param ModelInterface $model The current model. - * - * @param \MultiColumnWizard|BundleMultiColumnWizard $widget The multi column wizard instance. - * - * @param array $options The current options (defaults to empty array). + * @param string $propertyName The name of the multi-column wizard widget. + * @param string $subPropertyName The name of the sub widget. + * @param EnvironmentInterface $environment The environment instance. + * @param ModelInterface $model The current model. + * @param MultiColumnWizard|BundleMultiColumnWizard $widget The multi-column wizard instance. + * @param array|null $options The current options (defaults to empty array). */ public function __construct( $propertyName, @@ -101,7 +98,7 @@ public function __construct( EnvironmentInterface $environment, ModelInterface $model, $widget, - $options = array() + $options = [] ) { $this->propertyName = $propertyName; $this->subPropertyName = $subPropertyName; @@ -112,7 +109,7 @@ public function __construct( } /** - * Retrieve the name of the multi column wizard property. + * Retrieve the name of the multi-column wizard property. * * @return string */ @@ -122,7 +119,7 @@ public function getPropertyName() } /** - * Retrieve the name of the property within the multi column wizard. + * Retrieve the name of the property within the multi-column wizard. * * @return string */ @@ -152,9 +149,9 @@ public function getModel() } /** - * Retrieve the multi column wizard instance emitting the event. + * Retrieve the multi-column wizard instance emitting the event. * - * @return \MultiColumnWizard + * @return MultiColumnWizard */ public function getWidget() { @@ -164,7 +161,7 @@ public function getWidget() /** * Retrieve the options. * - * @return array + * @return array|null */ public function getOptions() { @@ -174,7 +171,7 @@ public function getOptions() /** * Set the options. * - * @param array $options The options. + * @param array|null $options The options. * * @return GetOptionsEvent */ From a32317ed7242513d74cece7f335c6b0c75c54051 Mon Sep 17 00:00:00 2001 From: e-spin Date: Wed, 14 Feb 2024 16:08:03 +0100 Subject: [PATCH 59/59] Add CS tokens --- .phpcq.yaml.dist | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.phpcq.yaml.dist b/.phpcq.yaml.dist index 38069f8..25556bd 100644 --- a/.phpcq.yaml.dist +++ b/.phpcq.yaml.dist @@ -51,6 +51,8 @@ phpcq: - D2CCAC42F6295E7D # PHP_CodeSniffer - 31C7E470E2138192 + - 9093F8B32E4815AA + - 5E6DDE998AB73B8E # Composer normalize - C00543248C87FB13 # phpmd