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 / Form.fusion
Last active May 24, 2019 13:48
Idea: Neos.Fusion.Forms
//
// the form component creates a formDescription object and adds it to context `form`
//
prototype(Neos.Fusion.Form:Form) < prototype(Neos.Fusion.Forms:FormComponent) {
renderer = afx`
<form action={form.action}>
<div style="display: none">
<Neos.Fusion:Loop items={form.hiddenFields} itemName="hiddenField">
<input type="hidden" name={hiddenField.name} value={hiddenField.value} />
</Neos.Fusion:Loop>
prototype(Vendor.Site:Component.Organism.Header.Fixtures) < prototype(Neos.Fusion:DataStructure) {
mainMenuItems ...
languageMenuItems ...
}
@mficzel
mficzel / ExampleController.php
Last active June 7, 2019 06:26
Backend Module with Fusion-AFX
<?php
namespace Test\BeModule\Controller;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Mvc\View\ViewInterface;
use Neos\Fusion\View\FusionView;
use Neos\Neos\Controller\Module\AbstractModuleController;
class ExampleController extends AbstractModuleController
{
@mficzel
mficzel / Component.Organism.Head.fusion
Created March 18, 2019 17:02
Seperation of Presentation and Integration
#
# Presentational - prototype that encapsulates rendering of a page header
# without caring where title and description originate from
#
# Notice:
# - the base prototype is Neos.Fusion:Component
#
prototype(Vendor.Site:Component.Organism.Head) < prototype(Neos.Fusion:Component) {
title = ''
intro = ''
@mficzel
mficzel / Menu.fusion
Last active February 25, 2019 08:04
SKETCH :: Extract Neos.Neos:MenuData from Neos.Neos:Menu
//
// The prototype Menu is now based on template, like he already is
// the calulation of the menu items is passed over to MenuData
//
prototype (Neos.Neos:Menu) < prototype(Neos.Neos:Template) {
templatePath = 'resource://Neos.Neos/Private/Templates/FusionObjects/Menu.html'
node = ${node}
items = ${this.items}
entryLevel = ${this.startingPoint ? 0 : 1}
@mficzel
mficzel / Example.fusion
Last active November 30, 2018 14:01
Ideas for status-rendering in the Neos-core as discussed by @grebaldi und @mficzel
#
# The rendering is implemented as special renderer for the error messages with a specific status code
#
# The fusion `error` path is rendered with only `site` and the `error` in the fusion context
#
error = Neos.Fusion:Case {
@context.notFoundNode = ${q(site).children('[uriPathSegment == 404]').get(0)}
404 {
condition = ${error.status == 404 && notFoundNode}
@mficzel
mficzel / example.fusion
Created November 16, 2018 14:12
Examples for Neos.Fusion:Reduce
sum = Neos.Fusion:Reduce {
items = ${ __array_of_products__ }
initialValue = 0
itemReducer = ${carry + item.price}
}
cheapest = Neos.Fusion:Reduce {
items = ${ __array_of_products__ }
initialValue = null
itemReducer = ${(!carry || carry.price > item.price) ? item : carry}
@mficzel
mficzel / Pagination_simple.fusion
Last active October 22, 2018 13:38
AFX Pagination
#
# simple pagination with parameter appending to a uri
#
prototype(Vendor.Site:Components.Molecules.Pagination) < prototype(PackageFactory.AtomicFusion:Component) {
@styleguide {
title = 'Pagination'
props {
current = 12
start = 8
end = 16
@mficzel
mficzel / PreviewPrototypeImplementation.php
Last active May 25, 2018 16:31
Optimized PreviewPrototypeImplementation
<?php
namespace Sitegeist\Monocle\FusionObjects;
/*
* This file is part of the Neos.Fusion package.
*
* (c) Contributors of the Neos Project - www.neos.io
*
* This package is Open Source Software. For the full copyright and license
* information, please view the LICENSE file which was distributed with this
@mficzel
mficzel / CollectionMapping.fusion
Last active February 5, 2018 10:48
Atomic.Fusion Collection Mapping :: Discussion of options
// Given the Neos.Fusion:Collection will iterate over the items that are given as array.
// If a ContentCollection is rendered and the nodes shall be edited inline the information
// wich node is rendererd has to be transferred to the collection whild keeping then interface
// of the component simple and serializable.
//
// This document discusses some of the possible syntax options.
//
// Automagic RawCollection
//