Skip to content

Commit

Permalink
Merge tag '2.3.21' into release/2.4.0
Browse files Browse the repository at this point in the history
Hotfix release 2.3.21

This fixes an issue in edit multiple mode containing
MultiColumnWizard widgets (See #649).
  • Loading branch information
zonky2 committed Aug 21, 2024
2 parents 29b8e49 + 6892fbd commit 0fc45b6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of contao-community-alliance/dc-general.
*
* (c) 2013-2023 Contao Community Alliance.
* (c) 2013-2024 Contao Community Alliance.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -14,7 +14,7 @@
* @author Sven Baumann <[email protected]>
* @author Richard Henkenjohann <[email protected]>
* @author Ingolf Steinhardt <[email protected]>
* @copyright 2013-2023 Contao Community Alliance.
* @copyright 2013-2024 Contao Community Alliance.
* @license https://github.com/contao-community-alliance/dc-general/blob/master/LICENSE LGPL-3.0
* @filesource
*/
Expand Down Expand Up @@ -263,22 +263,31 @@ private function renderEditFields(
$properties->addProperty($editProperty);

$this->setPropertyValue($editModel, $selectProperty, $propertyValuesBag);
$this->markEditErrors($editProperty, $selectProperty, $propertyValuesBag);
$rawValues = new PropertyValueBag();
foreach ($propertyValuesBag as $propName => $value) {
$rawValues->setPropertyValue($propName, $widgetManager->decodeValue($propName, $value));
}
$editErrors = $propertyValuesBag->getInvalidPropertyErrors();
foreach ($editErrors as $propName => $errors) {
$rawValues->markPropertyValueAsInvalid($propName, $errors);
}

$this->markEditErrors($editProperty, $selectProperty, $rawValues);
$this->markModelErrors(
$action,
$model,
$model,
$editProperty,
$selectProperty,
$propertyValuesBag,
$rawValues,
$environment
);

$fields[] = $widgetManager->renderWidget($editProperty->getName(), false, $propertyValuesBag);
$fields[] = $widgetManager->renderWidget($editProperty->getName(), false, $rawValues);
$fields[] = $this->injectSelectSubPropertiesInformation(
$selectProperty,
$editModel,
$propertyValuesBag,
$rawValues,
$environment
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,11 @@ private function findModelIdByPropertyName(BuildWidgetEvent $event)
*/
private function getOriginalPropertyName($propertyName, ModelIdInterface $modelId)
{
$originalPropertyName =
\trim(\substr($propertyName, \strlen(\str_replace('::', '____', $modelId->getSerialized()) . '_')), '[]');
$idValue = \str_replace('::', '____', $modelId->getSerialized());
if (1 === preg_match('#^' . preg_quote($idValue, '#') . '_\[?(?<name>[^]]*)]?$#', $propertyName, $matches)) {
return $matches['name'] ?: null;
}

return $originalPropertyName ?: null;
return null;
}
}
7 changes: 4 additions & 3 deletions src/View/ActionHandler/AbstractPropertyVisibilityHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -829,9 +829,10 @@ private function intersectModelSetPrimaryId(
}

$session = $this->getSession($action, $environment);

$intersectModel->setId($session['intersectValues'][$idProperty]);
$intersectModel->setProperty($idProperty, $session['intersectValues'][$idProperty]);
if (null !== ($idValue = $session['intersectValues'][$idProperty] ?? null)) {
$intersectModel->setId($idValue);
$intersectModel->setProperty($idProperty, $idValue);
}
}

/**
Expand Down

0 comments on commit 0fc45b6

Please sign in to comment.