Instantly share code, notes, and snippets.

View Root.fusion
prototype(Some.Package:Component.ContentWithToc) < prototype(Neos.Fusion:Component) {
blocks = Neos.Fusion:RawArray
renderer = afx`
<nav>
<ul>
<Neos.Fusion:Collection collection={props.blocks} itemName="block" @children="itemRenderer">
<li>
<a href={'#c-' + iterator.cycle}>{block.label}</a>
</li>
View MainMenuItems.fusion
prototype(Some.Package:MainMenuItems) < prototype(Neos.Fusion:Component) {
renderer = Neos.Fusion:RawCollection {
collection = ${q(site).children('[instanceof Neos.Neos:Document]').get()}
@context.rootline = ${q(documentNode).parents('[instanceof Neos.Neos:Document]').get()}
itemName = 'node'
itemRenderer = Some.Package:Component.Organism.Menu.Item {
title = ${q(node).property('title')}
href = Neos.Neos:NodeUri {
node = ${node}
}
View Component_Atom_DefaultElement.fusion
prototype(My.Package:Form.DefaultElement) < prototype(Neos.Fusion:Component) {
# API
id = ''
name = ''
label = ''
value = null
isRequired = false
properties = Neos.Fusion:RawArray
validationErrors = Neos.Fusion:RawArray
View rollyourown.php
<?php
// Context: I'm trying to argue that DI (and DIC) are great, and DIC libs suck.
// Happy to be proven wrong!
final class Router {
private $dependencies;
public function __construct (Dependencies $dependencies) {
$this->dependencies = $dependencies;
// You might say that this is Service Locator, but it's not. This router is toplevel,
// and toplevel must have access to dependencies. After that it can all just bubble nicely using proper DI.
View Routes.yaml
-
uriPattern: '{@action}/{segments}.html'
defaults:
'@package': 'Some.Package'
'@controller': 'SomeController'
'@action': 'index'
'@format': 'html'
routeParts:
'segments':
handler: 'Some\Package\Routing\SegmentsRoutePart'
View SomeCommandController.php
<?php
declare(strict_types=1);
namespace Some\Package\Command;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Cli\CommandController;
class SomeCommand extends CommandController
{
View ExampleEvent.php
<?php
namespace Some\Package
use Neos\EventSourcing\Event\EventInterface;
final class ExampleEvent implements EventInterface
{
/**
* @var UserId
*/
View FacetViewHelper.php
<?php
namespace Wwwision\Test\ViewHelpers\Link;
use Neos\FluidAdaptor\Core\ViewHelper\AbstractTagBasedViewHelper;
use Neos\FluidAdaptor\Core\ViewHelper;
/**
* Simple ViewHelper to create facet filter links
*
* Usage:
View SimpleTemplateView.php
<?php
namespace Some\Package\View;
use TYPO3\Flow\Mvc\View\AbstractView;
use TYPO3\Flow\Reflection\ObjectAccess;
class SimpleTemplateView extends AbstractView
{
/**
* @var array
View ActionIfGrantedViewHelper.php
<?php
namespace Your\Package\ViewHelpers\Link;
use TYPO3\Flow\Annotations as Flow;
use TYPO3\Flow\Aop\JoinPoint;
use TYPO3\Flow\Mvc\ActionRequest;
use TYPO3\Flow\Security\Authorization\Privilege\Method\MethodPrivilegeInterface;
use TYPO3\Flow\Security\Authorization\Privilege\Method\MethodPrivilegeSubject;
use TYPO3\Flow\Security\Authorization\PrivilegeManagerInterface;
use TYPO3\Fluid\ViewHelpers\Link\ActionViewHelper;