5.7 swap out page list controller

Permalink
Hello,

In all page lists we want to exclude certain pages based on their publish date. For this reason we wanted to swap out the controller with our own controller. This seems not possible because the pagelist is not registered in the app container.
\Core::bind('\Concrete\Core\Page\PageList', function ($app, $params) {
                return new \Concrete\Package\MyPackage\Src\Page\PageList();
            });


Another possible solution was to replace the alias. The problem is that not in all blocks the alias is used. So this won't work.
'aliases' => array(
        'PageList' => 'Concrete\Package\ZuiderlichtUtilities\Src\Page\PageList',
    ),


Is there another way to achive this?

Thx

 
jakobfuchs replied on at Permalink Reply
jakobfuchs
rge replied on at Permalink Reply
Thanks, I had not seen this page. Unfortunately there is solution for the problem I described. PageList is not part of the app container (service provider). And since it is located in the concrete/src folder I can not overwrite it via the application folder.

Overwriting it via the config is possible (alias). But the problem is that the class is sometimes initiated via the alias and other times via the full namespace.

new PageList();
new \Concrete\Core\Page\PageList()
jakobfuchs replied on at Permalink Reply
jakobfuchs
I have never tried that, so I can't give any useful input. I think your best bet is to search the existing issues on github and when in doubt create a new one. The overrides system is far from perfect, so it might be necessary to this in a 'hacky' way.
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi rge,

If you don't find a solution regarding this, I recommend posting to Stack Overflow.
https://www.concrete5.org/developers/stack-overflow...

Please cross-post any answers from Stack Overflow to this discussion.
rge replied on at Permalink Reply
Thanks for the reply.

I have created the question on stackoverflow. I will give an update if a receive an answer.