Override core block controllers within package
PermalinkI have problem with overriding core block controller in my package. I used to have this override in root block folder, and it worked fine, but when I moved it do package it stopped to work. I assume that there is some problem with location of controller or/and with name of it. I couldn't find any naming conventions or advanced overriding tutorials so I'm asking for help.
Here's sytuation. I want to override tags controller. I had controller in root/blocks/tags/controller.php and as I said, it worked perfectly fine.
As I moved it do package I found out that it was working no longer. Tryied to move controller to packageName/controllers/blocks/tags/controller.php but it also didn't work.
So here's my question. How do I override core block controller in package?
Any kind of help appreciated
At the moment the core team generally don't approve marketplace packages that override the core this way.
A little documentation on the matter won't hurt.
The outer directory overrides _everything_ - including stuff in packages. You can make a custom template, and it will read that, but it's not overriding anything to do that, just parsing for available templates.
You want to put an on_start function like this in your package controller:
public function on_start() {
$objEnv = Environment::get();
$objEnv->overrideCoreByPackage('controllers/dashboard/composer/write.php', $this);
$objEnv->overrideCoreByPackage('single_pages/dashboard/composer/write.php', $this);
}