File tree Expand file tree Collapse file tree 2 files changed +20
-9
lines changed
src/CoreBundle/Contao/Hooks Expand file tree Collapse file tree 2 files changed +20
-9
lines changed Original file line number Diff line number Diff line change 2222
2323namespace MetaModels \CoreBundle \Contao \Hooks ;
2424
25+ use Contao \CoreBundle \Exception \AccessDeniedException ;
2526use Contao \DC_Table ;
2627
2728/**
@@ -45,10 +46,15 @@ class ContentElementCallback extends AbstractContentElementAndModuleCallback
4546 */
4647 public function buildFilterParameterList (DC_Table $ dataContainer )
4748 {
48- if (
49- null === ($ currentRecord = $ dataContainer ->getCurrentRecord ())
50- || $ currentRecord ['type ' ] !== 'metamodel_content '
51- ) {
49+ try {
50+ if (
51+ null === ($ currentRecord = $ dataContainer ->getCurrentRecord ())
52+ || $ currentRecord ['type ' ] !== 'metamodel_content '
53+ ) {
54+ return ;
55+ }
56+ } catch (AccessDeniedException $ exception ) {
57+ // If the access is denied, we don't want to build filter parameters.
5258 return ;
5359 }
5460
Original file line number Diff line number Diff line change 1919
2020namespace MetaModels \CoreBundle \Contao \Hooks ;
2121
22+ use Contao \CoreBundle \Exception \AccessDeniedException ;
2223use Contao \DC_Table ;
2324
2425/**
@@ -36,13 +37,17 @@ final class FilterContentElementCallback extends AbstractContentElementAndModule
3637 /** Called from tl_content.onload_callback. */
3738 public function buildFilterParameterList (DC_Table $ dataContainer ): void
3839 {
39- if (
40- null === ($ currentRecord = $ dataContainer ->getCurrentRecord ())
41- || $ currentRecord ['type ' ] !== 'metamodels_frontendfilter '
42- ) {
40+ try {
41+ if (
42+ null === ($ currentRecord = $ dataContainer ->getCurrentRecord ())
43+ || $ currentRecord ['type ' ] !== 'metamodels_frontendfilter '
44+ ) {
45+ return ;
46+ }
47+ } catch (AccessDeniedException $ exception ) {
48+ // If the access is denied, we don't want to build filter parameters.
4349 return ;
4450 }
45-
4651 $ this ->buildFilterParamsFor ($ dataContainer , 'metamodels_frontendfilter ' );
4752 }
4853}
You can’t perform that action at this time.
0 commit comments