How to override core block controller via Package

in the package’s on_start() method add

<?php
$this->app->bind(
    '\Concrete\Block\Image\Controller',
    '\Namespace\For\The\New\Image\Controller'
);

You have to do it that way in v9 because, for some reason, doing it the way below doesn’t work:

<?php
use Concrete\Block\Image\Controller as CoreImageController;
use Namespace\For\The\New\Image\Controller as ImageController;

$this->app->bind(
    CoreImageController::class,
    ImageController::class
);

That way works in v8 though

2 Likes