Skip to content

Commit

Permalink
[BUGFIX] Avoid "Undefined array key" in FilterService
Browse files Browse the repository at this point in the history
Related: #24
  • Loading branch information
julianhofmann committed Nov 30, 2023
1 parent d0e7377 commit 0483a56
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions Classes/Service/FilterService.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ protected function buildObjectFilter(string $filterName, array $filterConfigurat
[
'filterName' => $filterName,
'filterConfiguration' => $filterConfiguration,
'additionalInfo' => ['class' => self::class, 'method' => __METHOD__, 'line' => __LINE__]
'additionalInfo' => ['class' => self::class, 'method' => __METHOD__, 'line' => __LINE__],
]
);
unset($this->filter[$filterName]);
Expand All @@ -230,7 +230,7 @@ protected function buildFilter(): void
$this->logger->error(
'No plugin.tx_in2studyfinder.settings.settingsPid is set! This results in not appearing filter options in the frontend.',
[
'additionalInfo' => ['class' => self::class, 'method' => __METHOD__, 'line' => __LINE__]
'additionalInfo' => ['class' => self::class, 'method' => __METHOD__, 'line' => __LINE__],
]
);
}
Expand All @@ -242,7 +242,7 @@ protected function buildFilter(): void
'propertyPath' => $filterProperties['propertyPath'],
'frontendLabel' => $this->buildFrontendLabel($filterProperties),
'disabledInFrontend' => $this->isFilterInFrontendVisible($filterProperties),
'singleSelect' => $filterProperties['singleSelect'] ?? ''
'singleSelect' => $filterProperties['singleSelect'] ?? '',
];

switch ($filterProperties['type']) {
Expand All @@ -261,7 +261,7 @@ protected function buildFilter(): void
[
'filterName' => $filterName,
'filterProperties' => $filterProperties,
'additionalInfo' => ['class' => self::class, 'method' => __METHOD__, 'line' => __LINE__]
'additionalInfo' => ['class' => self::class, 'method' => __METHOD__, 'line' => __LINE__],
]
);
}
Expand All @@ -270,15 +270,17 @@ protected function buildFilter(): void

protected function getTypoScriptFilterConfiguration(): array
{
if (is_array($this->settings['filters']) && !empty($this->settings['filters'])) {
return $this->settings['filters'];
$filters = $this->settings['filters'] ?? [];

if (is_array($filters) && !empty($filters)) {
return $filters;
}

$this->logger->error(
'No typoscript filter configuration found!',
[
'settings' => $this->settings,
'additionalInfo' => ['class' => self::class, 'method' => __METHOD__, 'line' => __LINE__]
'additionalInfo' => ['class' => self::class, 'method' => __METHOD__, 'line' => __LINE__],
]
);

Expand Down

0 comments on commit 0483a56

Please sign in to comment.