Skip to content
Merged
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
14 changes: 10 additions & 4 deletions src/CoreBundle/Contao/Hooks/ContentElementCallback.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

namespace MetaModels\CoreBundle\Contao\Hooks;

use Contao\CoreBundle\Exception\AccessDeniedException;
use Contao\DC_Table;

/**
Expand All @@ -45,10 +46,15 @@ class ContentElementCallback extends AbstractContentElementAndModuleCallback
*/
public function buildFilterParameterList(DC_Table $dataContainer)
{
if (
null === ($currentRecord = $dataContainer->getCurrentRecord())
|| $currentRecord['type'] !== 'metamodel_content'
) {
try {
if (
null === ($currentRecord = $dataContainer->getCurrentRecord())
|| $currentRecord['type'] !== 'metamodel_content'
) {
return;
}
} catch (AccessDeniedException $exception) {
// If the access is denied, we don't want to build filter parameters.
return;
}

Expand Down
15 changes: 10 additions & 5 deletions src/CoreBundle/Contao/Hooks/FilterContentElementCallback.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

namespace MetaModels\CoreBundle\Contao\Hooks;

use Contao\CoreBundle\Exception\AccessDeniedException;
use Contao\DC_Table;

/**
Expand All @@ -36,13 +37,17 @@ final class FilterContentElementCallback extends AbstractContentElementAndModule
/** Called from tl_content.onload_callback. */
public function buildFilterParameterList(DC_Table $dataContainer): void
{
if (
null === ($currentRecord = $dataContainer->getCurrentRecord())
|| $currentRecord['type'] !== 'metamodels_frontendfilter'
) {
try {
if (
null === ($currentRecord = $dataContainer->getCurrentRecord())
|| $currentRecord['type'] !== 'metamodels_frontendfilter'
) {
return;
}
} catch (AccessDeniedException $exception) {
// If the access is denied, we don't want to build filter parameters.
return;
}

$this->buildFilterParamsFor($dataContainer, 'metamodels_frontendfilter');
}
}