Skip to content

Commit b242248

Browse files
committed
Merge tag '2.4.8'
Hotfix release 2.4.8 This fixes: - Fix deprecated BE navigation - Fix target for links in CE and FE-models - Fix priority für own BE MenuBuilder - Fix generate widget for internal attributes
2 parents 80c2dc6 + e864c9b commit b242248

8 files changed

Lines changed: 21 additions & 25 deletions

File tree

src/CoreBundle/Contao/Hooks/AbstractContentElementAndModuleCallback.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ private function renderEditButton(string $caption, string $title, UrlBuilder $ur
556556
);
557557

558558
return sprintf(
559-
'<a href="%s" title="%s" style="padding-left:3px">%s</a>',
559+
'<a href="%s" title="%s" target="_blank" style="padding-left:3px">%s</a>',
560560
$url->getUrl(),
561561
$title,
562562
$icon

src/CoreBundle/EventListener/BackendNavigationListener.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -280,14 +280,11 @@ private function updateCollapsedState(ItemInterface $metaModelsNode): void
280280
$sessionBag = $this->requestStack->getSession()->getBag('contao_backend');
281281
$status = ($sessionBag instanceof AttributeBagInterface) ? $sessionBag->get('backend_modules') : [];
282282
$isCollapsed = ($status[$nodeName] ?? 1) < 1;
283-
$path = $this->router->generate('contao_backend');
284283

285284
$metaModelsNode
286285
->setLinkAttribute('class', 'group-' . $nodeName)
287-
->setLinkAttribute(
288-
'onclick',
289-
"return AjaxRequest.toggleNavigation(this, '" . $nodeName . "', '" . $path . "')"
290-
)
286+
->setLinkAttribute('data-action', 'contao--toggle-navigation#toggle:prevent')
287+
->setLinkAttribute('data-contao--toggle-navigation-category-param', $nodeName)
291288
->setLinkAttribute('aria-controls', $nodeName)
292289
->setChildrenAttribute('id', $nodeName)
293290
->setLinkAttribute(

src/CoreBundle/EventListener/DcGeneral/Breadcrumb/BreadcrumbDcaSettingConditionListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ private function getConditionAttribute($settingId)
111111
} else {
112112
$title = StringUtil::deserialize($setting->legendtitle, true);
113113
// @deprecated usage of TL_LANGUAGE - remove for Contao 5.0.
114-
return ($title[LocaleUtil::formatAsLocale($GLOBALS['TL_LANGUAGE'])] ?? current($title));
114+
return ($title[LocaleUtil::formatAsLocale($GLOBALS['TL_LANGUAGE'])] ?? (string) current($title));
115115
}
116116

117117
return 'unknown ' . $setting->dcatype;

src/CoreBundle/EventListener/DcGeneral/DefinitionBuilder/PropertyDefinitionBuilder.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
use ContaoCommunityAlliance\DcGeneral\DataDefinition\Definition\Properties\PropertyInterface;
2828
use ContaoCommunityAlliance\DcGeneral\DataDefinition\Definition\PropertiesDefinitionInterface;
2929
use MetaModels\Attribute\IAttribute;
30+
use MetaModels\Attribute\IInternal;
3031
use MetaModels\Attribute\ITranslated;
3132
use MetaModels\DcGeneral\DataDefinition\IMetaModelDataDefinition;
3233
use MetaModels\DcGeneral\Events\MetaModel\BuildAttributeEvent;
@@ -122,7 +123,7 @@ protected function build(IMetaModelDataDefinition $container)
122123
}
123124

124125
foreach ($metaModel->getAttributes() as $attribute) {
125-
if (!isset($properties[$attribute->get('id')])) {
126+
if ($attribute instanceof IInternal || !isset($properties[$attribute->get('id')])) {
126127
continue;
127128
}
128129
$this->buildProperty(

src/CoreBundle/Resources/config/listeners.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ services:
8282
- '@security.token_storage'
8383
- '@router'
8484
tags:
85-
- { name: kernel.event_listener }
85+
- { name: kernel.event_listener, priority: -100 }
8686

8787
MetaModels\CoreBundle\EventListener\DoctrineSchemaListener:
8888
arguments:

src/FrontendIntegration/FrontendFilter.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -634,11 +634,7 @@ private function getBaseParameters(array $values): array
634634
return [];
635635
}
636636

637-
if (null === ($filterSetting = $this->objFilterConfig->getFilterCollection())) {
638-
throw new RuntimeException(
639-
'Error: no filter object defined, call setFilterSettings() before setFilterParameters().'
640-
);
641-
}
637+
$filterSetting = $this->objFilterConfig->getFilterCollection();
642638

643639
$presetNames = $filterSetting->getParameters();
644640
$filterParamKeys = \array_keys($filterSetting->getParameterFilterNames());

src/FrontendIntegration/MetaModelHybrid.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,13 @@
4141
/**
4242
* Base implementation of a MetaModel Hybrid element.
4343
*
44-
* @property string $id The id of the element.
45-
* @property string $name The module name to use (if type is module).
46-
* @property string $metamodel The id of the MetaModel to use.
47-
* @property string $metamodel_filtering The id of the MetaModel filter setting to use.
48-
* @property string $metamodel_rendersettings The id of the MetaModel render setting to use.
49-
* @property bool $metamodel_sort_override The flag to override sorting.
44+
* @property string $id The id of the element.
45+
* @property string $name The module name to use (if type is module).
46+
* @property string $metamodel The id of the MetaModel to use.
47+
* @property string $metamodel_filtering The id of the MetaModel filter setting to use.
48+
* @property string $metamodel_rendersettings The id of the MetaModel render setting to use.
49+
* @property bool $metamodel_sort_override The flag to override sorting.
50+
* @property list<string> $cssID The CSS id and classes.
5051
*
5152
* @psalm-type TDatabaseResult=object{
5253
* cssID: string,
@@ -155,7 +156,7 @@ protected function getConnection()
155156
* Create a new instance.
156157
*
157158
* @param Result|TDatabaseResult $objElement The object from the database.
158-
* @param string $strColumn The column the element is displayed within.
159+
* @param string $strColumn The column the element is displayed within.
159160
*/
160161
public function __construct($objElement, $strColumn = 'main')
161162
{
@@ -165,6 +166,7 @@ public function __construct($objElement, $strColumn = 'main')
165166
$this->arrData = \method_exists($objElement, 'row') ? $objElement->row() : (array) $objElement;
166167

167168
// Get CSS ID and headline from the parent element (!).
169+
/** @psalm-suppress PropertyTypeCoercion */
168170
$this->cssID = StringUtil::deserialize($objElement->cssID, true);
169171
$this->typePrefix = $objElement->typePrefix ?? '';
170172
$this->strKey = $objElement->type;

src/Widgets/SubDcaWidget.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class SubDcaWidget extends Widget
9797
/**
9898
* The prepared widgets.
9999
*
100-
* @var array
100+
* @var list<list<Widget>>
101101
*/
102102
protected $arrWidgets = [];
103103

@@ -567,9 +567,9 @@ protected function buildOptions()
567567
$options = [];
568568
foreach ($this->arrWidgets as $widgetRow) {
569569
$columns = [];
570-
foreach ((array) $widgetRow as $widget) {
571-
/** @var Widget $widget */
572-
$rawValign = (string) ($widget->valign ?? '');
570+
foreach ($widgetRow as $widget) {
571+
/** @psalm-suppress UndefinedMagicPropertyFetch */
572+
$rawValign = ((string) $widget->valign) ?: '';
573573
$valign = ($rawValign !== '' ? ' valign="' . $rawValign . '"' : '');
574574
$rawClass = $widget->class;
575575
$class = ($rawClass !== '' ? ' class="' . $rawClass . '"' : '');

0 commit comments

Comments
 (0)