Skip to content

Commit

Permalink
Merge tag '3.6.9'
Browse files Browse the repository at this point in the history
Hotfix release 3.6.9

- Fix post action PHP8 warning
- Fix for File Picker Types Array Handling in TinyMce Integration
  • Loading branch information
stefanheimes committed Nov 26, 2024
2 parents a3dfe6a + fb6f10f commit 1005646
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 16 deletions.
23 changes: 14 additions & 9 deletions src/Contao/Widgets/MultiColumnWizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -1071,16 +1071,21 @@ protected function initializeWidget(&$arrField, $intRow, $strKey, $varValue)

// Add the help wizard
if (isset($arrField['eval']['helpwizard']) && $arrField['eval']['helpwizard']) {
$label = (isset($arrField['label']) && is_array($arrField['label']) && isset($arrField['label'][0]))
? $arrField['label'][0]
: 'Help';

// Construct the help wizard link
$xlabel .= ' <a href="contao/help.php?table=' . $this->strTable . '&amp;field=' . $this->strField
. '" title="' . StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['helpWizard'])
. '" onclick="Backend.openModalIframe({\'width\':735,\'height\':405,\'title\':\''
. StringUtil::specialchars(str_replace("'", "\\'", $arrField['label'][0]))
. '\',\'url\':this.href});return false">'
. Image::getHtml(
'about.gif',
$GLOBALS['TL_LANG']['MSC']['helpWizard'],
'style="vertical-align:text-bottom"'
) . '</a>';
. '" title="' . StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['helpWizard'])
. '" onclick="Backend.openModalIframe({\'width\':735,\'height\':405,\'title\':\''
. StringUtil::specialchars(str_replace("'", "\\'", $label))
. '\',\'url\':this.href});return false">'
. Image::getHtml(
'about.gif',
$GLOBALS['TL_LANG']['MSC']['helpWizard'],
'style="vertical-align:text-bottom"'
) . '</a>';
}

// Add the popup file manager
Expand Down
6 changes: 3 additions & 3 deletions src/ContaoManager/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -15,7 +15,7 @@
* @author Stefan Heimes <stefan_heimes@hotmail.com>
* @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
*/
Expand All @@ -37,7 +37,7 @@ class Plugin implements BundlePluginInterface
/**
* {@inheritdoc}
*/
public function getBundles(ParserInterface $parser)
public function getBundles(ParserInterface $parser): array
{
return [
BundleConfig::create(MultiColumnWizardBundle::class)
Expand Down
3 changes: 2 additions & 1 deletion src/EventListener/Contao/ExecutePostActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ public function executePostActions($action, DataContainer $container)
// Add the sub configuration into the DCA. We need this for contao. Without it is not possible
// to get the data for the picker.
if (
($GLOBALS['TL_DCA'][$container->table]['fields'][$mcwBaseName]['inputType'] == 'multiColumnWizard')
(($GLOBALS['TL_DCA'][$container->table]['fields'][$mcwBaseName]['inputType'] ?? null)
=== 'multiColumnWizard')
&& !($container instanceof DataContainerInterface)
) {
$widget = MultiColumnWizard::generateSimpleMcw($container->table, $mcwBaseName);
Expand Down
9 changes: 6 additions & 3 deletions src/EventListener/Mcw/TinyMce.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ public function executeEvent(GetTinyMceStringEvent $event)
$table = $event->getTableName();
$fieldId = $event->getFieldId();

list ($file, $type) = explode('|', $field['eval']['rte'], 2);
list ($file, $type) = explode('|', $field['eval']['rte'] ?? '') + [null, null];

$fileBrowserTypes = array();
$fileBrowserTypes = [];
// Since we don't know if this is the right call for other versions of contao
// we won't use dependencies injection.
$pickerBuilder = System::getContainer()->get('contao.picker.builder');
Expand All @@ -59,11 +59,14 @@ public function executeEvent(GetTinyMceStringEvent $event)
}
}

// Convert fileBrowserTypes to a comma-separated string for TinyMCE compatibility.
$fileBrowserTypesString = implode(',', $fileBrowserTypes);

/** @var BackendTemplate|object $objTemplate */
$objTemplate = new BackendTemplate('be_' . $file);
$objTemplate->selector = 'ctrl_' . $fieldId;
$objTemplate->type = $type;
$objTemplate->fileBrowserTypes = $fileBrowserTypes;
$objTemplate->fileBrowserTypes = $fileBrowserTypesString;
$objTemplate->source = $table . '.' . $fieldId;

// Deprecated since Contao 4.0, to be removed in Contao 5.0
Expand Down

0 comments on commit 1005646

Please sign in to comment.