2017 © Pedro Peláez
 

neos-carbon condition

This package provides some fusion helper for making writing conditions (`@if`) easier.

image

carbon/condition

This package provides some fusion helper for making writing conditions (`@if`) easier.

  • Tuesday, July 3, 2018
  • by jonnitto
  • Repository
  • 1 Watchers
  • 2 Stars
  • 1,619 Installations
  • 7 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 101 % Grown

The README.md

Latest Stable Version Total Downloads License GitHub forks GitHub stars GitHub watchers, (*1)

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, (*2)

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., (*3)

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:, (*4)

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., (*5)

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., (*6)

You can also mix the conditions:, (*7)

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., (*8)

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:

Property Description
node The node as starting point for the query
enabled If set to false, it return always false
content.nodeType Set the node type
content.propertyFilter This string gets appended to the content.filter. Example usage see above
content.collection The filter string for the content collection. Normally you don't need to change this property.
content.filter The filter string for the content element. Normally you don't need to change this property.
document.nodeType Set the node type
document.propertyFilter This string gets appended to the document.filter. Example usage see above
document.filter The filter string for the document element. Normally you don't need to change this property.
context.backend If set to true, the value is always return true in backend context
context.live If set to true, the value is always return true in live context

Carbon.Condition:Properties

Link to the fusion file
Helper for checking if the element should get rendered or not. Example usage:, (*9)

@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., (*10)

Default values

node = ${node}

properties = null
operator = 'AND'

context {
    backend = true
    live = false
}

Overview of properties:

Property Default value Description
node ${node} The node as starting point for the query
properties false Set the needed properties as comma seperated string. You can mix string and object based properties.
operator 'AND' If set to 'AND' or '&&', all properties have to be set. If it set to 'OR' or '\|\|' only one property is needed
context.backend true If set to true, the value is always return true in backend context
context.live false If set to true, the value is always return true in live context

The Versions

03/07 2018

dev-master

9999999-dev

This package provides some fusion helper for making writing conditions (`@if`) easier.

  Sources   Download

MIT

The Requires

 

helper carbon flow neos condition fusion

03/07 2018

1.1.2

1.1.2.0

This package provides some fusion helper for making writing conditions (`@if`) easier.

  Sources   Download

MIT

The Requires

 

helper carbon flow neos condition fusion

01/05 2018

1.1.1

1.1.1.0

This package provides some fusion helper for making writing conditions (`@if`) easier.

  Sources   Download

MIT

The Requires

 

helper carbon flow neos condition fusion

27/04 2018

1.1.0

1.1.0.0

This package provides some fusion helper for making writing conditions (`@if`) easier.

  Sources   Download

MIT

The Requires

 

helper flow neos condition fusion

17/01 2018

1.0.1

1.0.1.0

This package provides some fusion helper for making writing conditions (`@if`) easier.

  Sources   Download

MIT

The Requires

 

helper flow neos condition fusion

16/01 2018

1.0.0

1.0.0.0

This package provides some fusion helper for making writing conditions (`@if`) easier.

  Sources   Download

MIT

The Requires

 

helper flow neos condition fusion