Override/Extend /concrete/core/controllers/blocks/pagelist.php to root

Permalink
Hello,

I needed to add this code in pagelist.php (function getPages()) file to be able to filter pageslists by attribute tags.

if (isset($_GET['mytag'])) {
   $pl->filterByAttribute('tags', "%\n{$_GET[mytag]}\n%", "like");
}


The problem is that I am editing a file from the core:
/concrete/core/controllers/blocks/pagelist.php

How can i override/extend this file to the root? I tried to put in the root folder controller the but without success

Thanks,
Tiago Valverde

tiagovalverde
 
JohntheFish replied on at Permalink Reply
JohntheFish
tiagovalverde replied on at Permalink Reply
tiagovalverde
Hi JohnTheFish,

Thanks for the links, it helped me understanding better the blocks customization and the core files overriding.

The problem was that i tried to override the controller file /concrete/core/controllers/blocks/pagelist.php but the file was already extended by the file /concrete/blocks/page_list/controller.php.

I copy the controller.php file to /blocks/page_list/ and added the function that i edited and it worked.

Best regards,
Tiago Valverde
JohntheFish replied on at Permalink Reply
JohntheFish
In 5.6+, you need to extend the class that starts core.... in the same way that the block does.