carbon / condition
This package provides some fusion helper for making writing conditions (`@if`) easier.
Fund package maintenance!
jonnitto
www.paypal.me/Jonnitto/20eur
Installs: 51 886
Dependents: 5
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 0
Open Issues: 0
Type:neos-carbon
Requires
- neos/neos: ~5.3 || ~7.0 || ~8.0
README
Carbon.Condition Package for Neos CMS
This package provides some fusion helper for making writing conditions (@if
) easier.
You can look at a real world example here
Installation
Carbon.Condition
is available via packagist. Add "carbon/condition" : "^2.0"
to the require section of your composer.json or run composer require carbon/condition
.
Carbon.Condition:Case
Link to the fusion file
Return true if a content element or a node type definition is on a document.
Example usage:
value = 'FooBar' value.@if.render = Carbon.Condition:Case { content { nodeType = 'Foo.Bar:NodeType' propertyFilter = '[row != "one"]' } }
In the example above the value FooBar
gets only rendered if a content node type
Foo.Bar:NodeType
with the property row
set not to one
is on the current document.
value = 'FooBar' value.@if.render = Carbon.Condition:Case { document.nodeType = 'Foo.Bar:MixinNodeType' }
In the example above the value FooBar
gets only rendered if the document has
the mixin Foo.Bar:MixinNodeType
.
You can also mix the conditions:
value = 'FooBar' value.@if.render = Carbon.Condition:Case { content { nodeType = 'Foo.Bar:MixinLightbox' propertyFilter = '[lightbox=true]' } document { nodeType = 'Foo.Bar:MixinLightbox' propertyFilter = '[lightbox=true]' } }
In the example above the value FooBar
gets only rendered if the document or a
content element has the mixin Foo.Bar:MixinLightbox
and the property lightbox
set to true
.
Default values
node = ${documentNode} enabled = true content { collection = '[instanceof Neos.Neos:ContentCollection]' nodeType = null propertyFilter = '' filter = ${this.nodeType ? ('[instanceof ' + this.nodeType + ']' + this.propertyFilter) : null} } document { nodeType = null propertyFilter = '' filter = ${this.nodeType ? ('[instanceof ' + this.nodeType + ']' + this.propertyFilter) : null} } context { backend = true live = false }
Overview of properties:
Carbon.Condition:Properties
Link to the fusion file
Helper for checking if the element should get rendered or not. Example usage:
@if.render = Carbon.Condition:Properties { properties = 'title,image' }
In the example above the condition is only get true
if the node
has title
and image
set.
Default values
node = ${node} properties = null operator = 'AND' context { backend = true live = false }