Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"require": {
"php": "^8.2",
"ext-dom": "*",
"contao-community-alliance/dc-general": "^2.4.12",
"contao-community-alliance/dc-general": "^2.4.13",
"contao-community-alliance/events-contao-bindings": "^5.0",
"contao-community-alliance/meta-palettes": "^2.0.10",
"contao-community-alliance/translator": "^2.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@
'mandatory' => true,
'tl_class' => 'clr',
],
'sql' => "text NOT NULL default ''"
'sql' => 'text NULL'
],
'label' => [
'label' => 'label.label',
Expand Down
8 changes: 6 additions & 2 deletions src/Filter/Setting/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of MetaModels/core.
*
* (c) 2012-2024 The MetaModels team.
* (c) 2012-2026 The MetaModels team.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -17,7 +17,7 @@
* @author Sven Baumann <baumann.sv@gmail.com>
* @author Richard Henkenjohann <richardhenkenjohann@googlemail.com>
* @author Ingolf Steinhardt <info@e-spin.de>
* @copyright 2012-2024 The MetaModels team.
* @copyright 2012-2026 The MetaModels team.
* @license https://github.com/MetaModels/core/blob/master/LICENSE LGPL-3.0-or-later
* @filesource
*/
Expand Down Expand Up @@ -208,6 +208,10 @@ public function getParameterFilterWidgets(
$arrJumpTo,
FrontendFilterOptions $objFrontendFilterOptions
) {
if (null === $this->metaModel) {
return [];
}

$parameters = [];
$metaModel = $this->getMetaModel();
$previousLanguage = ($metaModel instanceof ITranslatedMetaModel)
Expand Down
55 changes: 55 additions & 0 deletions tests/Filter/Setting/CollectionTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php

/**
* This file is part of MetaModels/core.
*
* (c) 2012-2026 The MetaModels team.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* This project is provided in good faith and hope to be usable by anyone.
*
* @package MetaModels/core
* @author Ingolf Steinhardt <info@e-spin.de>
* @copyright 2012-2026 The MetaModels team.
* @license https://github.com/MetaModels/core/blob/master/LICENSE LGPL-3.0-or-later
* @filesource
*/

namespace MetaModels\Test\Filter\Setting;

use MetaModels\Filter\Setting\Collection;
use MetaModels\FrontendIntegration\FrontendFilterOptions;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;

/**
* @covers \MetaModels\Filter\Setting\Collection
*/
#[CoversClass(Collection::class)]
class CollectionTest extends TestCase
{
/**
* When no MetaModel is set (e.g. FE list module with no filter configured),
* getParameterFilterWidgets() must return an empty array instead of throwing a RuntimeException.
*/
public function testGetParameterFilterWidgetsReturnsEmptyArrayWhenNoMetaModelSet(): void
{
$collection = new Collection([]);

$result = $collection->getParameterFilterWidgets([], [], new FrontendFilterOptions());

self::assertSame([], $result);
}

/**
* getParameters() returns an empty array when the collection has no settings.
*/
public function testGetParametersReturnsEmptyArrayWhenNoSettings(): void
{
$collection = new Collection([]);

self::assertSame([], $collection->getParameters());
}
}