Skip to content

Controllers

By configuring a controller you can modify and enhance the way in which the built-in content view controller renders content.

You indicate which controller to use in the content view configuration, under the controller configuration key:

1
2
3
4
5
                    article:
                        controller: App\Controller\RelationController::showContentAction
                        template: '@ibexadesign/full/article.html.twig'
                        match:
                            Identifier\ContentType: article
1
2
3
4
5
6
7
namespace App\Controller;

use Ibexa\Contracts\Core\Repository\ContentService;
use Ibexa\Contracts\Core\Repository\LocationService;
use Ibexa\Core\MVC\Symfony\View\View;

class RelationController

For a full example of using a custom controller, see Embed content.

If you don't want to use the default view controller and only use a custom one, use the same configuration, but don't provide the template key. You have to indicate the template to use from the controller itself.

Permissions for custom controllers

See permission documentation for information about access control for custom controllers.