Skip to content

Instantly share code, notes, and snippets.

@mficzel
Created November 21, 2019 12:07
Show Gist options
  • Save mficzel/4c8af492bcfa3d5536ddc09caac8ea6c to your computer and use it in GitHub Desktop.
Save mficzel/4c8af492bcfa3d5536ddc09caac8ea6c to your computer and use it in GitHub Desktop.
Using the Fusion View in a Backend Module
<?php´
namespace Vendor\Site\Controller;
use Neos\Flow\Annotations as Flow;
use Neos\Neos\Controller\Module\AbstractModuleController;
use Neos\Fusion\View\FusionView;
class FusionController extends AbstractModuleController
{
/**
* tell the controller to use the fusion view
*/
protected $defaultViewObjectName = FusionView::class;
public function indexAction(): void
{
$this->view->assign('example', 'some value to assign as example');
}
}
# require the fusion from other packages
include: resource://Neos.Fusion/Private/Fusion/Root.fusion
include: resource://Neos.Fusion.Form/Private/Fusion/Root.fusion
# assign the controller pathes to prototypes
Vendor.Site.FusionController.index = Vendor.Site:Example
# ofcourse yopu can define the renderer directly on the path aswell
Vendor.Site.FusionController.other = Vendor.Site:Example
# define the actual rendering prototype
prototype(Vendor.Site:Example) < prototype(Neos.Fusion:Component) {
renderer = afx`
<h2>Here comes the {example}</h2>
`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment