Skip to content

Instantly share code, notes, and snippets.

View mficzel's full-sized avatar

Martin Ficzel mficzel

  • sitegeist neos solutions GmbH
  • Germany, Hamburg
View GitHub Profile
@mficzel
mficzel / source.fusion
Created October 17, 2019 10:58
Fusion DSL json`...`
jsonLd = json`{
"@context": "http://schema.org",
"@type": "Organization",
"name": "Neos",
"url": "${__someExpression__}",
"contactPoint:$<Neos.Fusion:Map>": {
"items": "${__someExpression__}",
"itemRenderer": {
"@type": "ContactPoint"
"contactType": "${__someExpression__}",
@mficzel
mficzel / WrapperComponent.fusion
Last active June 2, 2024 15:13
Wrapper components
prototype(Vendor.Site:Example) < prototype(Neos.Fusion:Component) {
foo = null
bar = null
renderer = Neos.Fusion:Component {
# pass all outer props to the renderer
@apply.props = ${props}
# alternatively pass explicit props to the renderer
foo = ${props.foo}
@mficzel
mficzel / FusionController.php
Created November 21, 2019 12:07
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
{
/**
@mficzel
mficzel / Query.sql
Created January 28, 2020 14:39
Neos - Find out which nodes were added below a specific type
SELECT node.nodetype, parent.nodetype, count(*) FROM `neos_contentrepository_domain_model_nodedata` AS node
JOIN `neos_contentrepository_domain_model_nodedata`
AS parent
ON node.parentpath = parent.path
WHERE parent.nodetype='Vendor.Site:NodeType'
GROUP by node.nodetype
@mficzel
mficzel / 1_Usage.fusion
Last active April 10, 2020 09:31
Filter list by reference intersection
videos = Neos.Fusion:Loop {
items = Vendor.Site:VideoNodesByTag {
tags =
}
renderer = afx`<div>{item.title}</div>`
}
@mficzel
mficzel / ContactController.php
Last active July 3, 2020 08:17
Contact-form example with Neos.Fusion.Form and a custom controller
<?php
namespace Vendor\Site\Controller;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Mvc\Controller\ActionController;
use Neos\SwiftMailer\Message as SwiftMailerMessage;
class ContactController extends ActionController
{
/**
@mficzel
mficzel / Overview.md
Last active September 4, 2020 08:16
Neos Caching 101

Caching is hard but worth the hassle

Motivation

  • no clear cache button
  • 100 % transparent for editors
  • good caching makes sites fast

We are forced to configure caching right as otherwise editors will complain

@mficzel
mficzel / example.fusion
Last active September 18, 2020 12:27
Filter lists with Neos.Fusion:Reduce
foo = Neos.Fosion:Reduce {
items = ${something}
initialValue = ${[]}
# when the condition matches include the item into the result
# otherwise return sam array as before
itemReducer = ${ (__condition__) ? Array.push(carry, item) : carry}
#defaults
itemName = 'item'
@mficzel
mficzel / _helpers.tpl
Last active January 19, 2021 20:15
Kubernetes Green / Blue deployment with Helm
{{/*
Create revion color "green" / "blue" from release number
*/}}
{{- define "project.revisioncolor" -}}
{{- if mod .Release.Revision 2 -}}
{{- printf "green" -}}
{{- else -}}
{{- printf "blue" -}}
{{- end -}}
{{- end -}}
@mficzel
mficzel / CommandController.php
Created March 3, 2021 14:41
Partial Node export
<?php
namespace Sitegeist\NodeShippingService\Command;
use Neos\ContentRepository\Domain\Service\ImportExport\NodeExportService;
use Neos\ContentRepository\Domain\Service\ImportExport\NodeImportService;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Cli\CommandController;
use Neos\Neos\Exception as NeosException;
use Neos\Utility\Files;
use Neos\ContentRepository\Domain\Repository\NodeDataRepository;