Can you extend a core block controller in a package ?

Permalink
I have successfully extended the image_slider controller via the application/blocks/image_slider directory. Now I want to move that to a package. I followed the instructions at:

https://www.concrete5.org/documentation/developers/5.7/working-with-...

but I can not get it to work.

Can you extend a core block in a package or do you have to create a whole new block ? And if you do have to create a whole new block, can you name it the same as a core block and will it then override the core block ?

Thanks,

Warren Bell

warish
 
A3020 replied on at Permalink Reply
A3020
Good questions. There's a lack of documentation about overrides in general. Hopefully someone from the core team picks it up soon!
goesredy replied on at Permalink Reply
goesredy
Sorry if this too late reply.
You can do that using environment class. But this will only work if you don't have any override inside application directory.
Put this on your package on_start event;
public function on_start() {
    $objEnv = Environment::get();
    $objEnv->overrideCoreByPackage('blocks/image_slider/controller.php', $this);
}

Remember to put this under namespace;
use Concrete\Core\Foundation\Environment;

Class API can be found here:http://documentation.concrete5.org/api/class-Concrete.Core.Foundati...