Skip to content

Instantly share code, notes, and snippets.

@dimaip
Last active November 21, 2016 17:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dimaip/d89ff6c5f3b656207f9d to your computer and use it in GitHub Desktop.
Save dimaip/d89ff6c5f3b656207f9d to your computer and use it in GitHub Desktop.
actionsOnNodeCreation and wizard examples
# Set document node title on creation
'TYPO3.Neos:Document':
actionsOnNodeCreation:
'setDocumentTitle':
type: 'setNodeProperties'
options:
propertyValues:
'title': '${data.title}'
enabled: '${true}' # Possibility to bypass action based on some conditions
ui:
creationDialog:
elements:
'title':
type: 'string'
ui:
label: 'Title'
# Auto create columns based on node count input
'My.Grid:Row':
actionsOnNodeCreation:
'createGridColumns':
type: 'createNodes'
options:
nodeType: 'My.Grid:Column'
nodePath: 'main' # Defaults to direct child of current node when unset
nodeAmount: '${data.nodeCount}' # defaults to one
propertyValues:
'className': "${'column-' + 12 / data.nodeCount}"
ui:
label: 'Grid Row'
wizard:
type: 'DefaultWizard' # Possible to replace by completely custom implementation of wizard in a fully quealified format
ui:
groups:
'main':
label: 'Main'
properties:
'nodeCount':
type: 'string'
ui:
label: 'Node count'
# Rethink AssetList, create Asset nodes based on selected assets
'TYPO3.Neos.NodeTypes:AssetList':
actionsOnNodeCreation:
'createImageNodesForGallery':
type: 'createNodesFromArray'
options:
source: '${data.assets}'
nodeType: 'TYPO3.Neos.NodeTypes:Asset'
propertyName: 'asset'
ui:
wizard:
'assets':
type: array<TYPO3\Media\Domain\Model\Asset>
ui:
label: 'Assets'
# Create customised dummy teaser Text node, based on category of parent node
'My.News:Article':
actionsOnNodeCreation:
'createDefaultTeaser':
type: 'createNodes'
options:
nodeType: 'TYPO3.Neos.NodeTypes:Text'
nodePath: 'teaser'
propertyValues:
'text': "${'This is a dummy text for a ' + q(node).property('category') + ' article'}" # node, documentNode, siteNode and wizard are available as context variables
# Custom action on node creation: create a nested predefined structure of nodes
'My.Package:Tabs':
actionsOnNodeCreation:
'fillInWithDummyContent':
type: '\My\Package\ActionsOnNodeCreation\CreateNodesFromStructure'
options:
nodeStructure:
- nodeType: 'My.Package:TabItem'
properties:
title: 'Tab 1'
activeTab: TRUE
children:
- nodeType: 'TYPO3.Neos.NodeTypes:Text'
properties:
text: '<h4>Tab panel 1</h4><p>This is a sample tab 1 content.</p>'
- nodeType: 'My.Package:TabItem'
properties:
title: 'Tab 2'
children:
- nodeType: 'TYPO3.Neos.NodeTypes:Text'
properties:
text: '<h4>Tab panel 2</h4><p>This is a sample tab 2 content.</p>'
- nodeType: 'My.Package:TabItem'
properties:
title: 'Tab 3'
children:
- nodeType: 'TYPO3.Neos.NodeTypes:Text'
properties:
text: '<h4>Tab panel 3</h4><p>This is a sample tab 3 content.</p>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment