diff --git a/Neos.Fusion.Afx/README.md b/Neos.Fusion.Afx/README.md index 16581d02069..8bfcadec7ea 100644 --- a/Neos.Fusion.Afx/README.md +++ b/Neos.Fusion.Afx/README.md @@ -354,10 +354,10 @@ Neos.Fusion:Join { ## Examples -### Rendering of Collections with `Neos.Fusion:Collection` +### Rendering of Collections with `Neos.Fusion:Loop` For rendering of lists or menus a presentational-component usually will recieve arrays of -preprocessed data as prop. To iterate over such an array the `Neos.Fusion:Collection` +preprocessed data as prop. To iterate over such an array the `Neos.Fusion:Loop` can be used in afx. ``` @@ -368,11 +368,11 @@ prototype(Vendor.Site:IterationExample) < prototype(Neos.Fusion:Component) { renderer = afx` ` } @@ -389,11 +389,11 @@ prototype(PackageFactory.AtomicFusion.AFX:SliderExample) < prototype(Packagefact images = ${[]} renderer = afx`
- + - +
` } diff --git a/Neos.Fusion/Classes/FusionObjects/AbstractCollectionImplementation.php b/Neos.Fusion/Classes/FusionObjects/AbstractCollectionImplementation.php deleted file mode 100644 index a8b46e46d30..00000000000 --- a/Neos.Fusion/Classes/FusionObjects/AbstractCollectionImplementation.php +++ /dev/null @@ -1,61 +0,0 @@ -fusionValue('collection'); - } - - /** - * @return array - */ - public function getItems() - { - return $this->getCollection(); - } - - /** - * Evaluate the collection nodes as concatenated string - * - * @return string - * @throws FusionException - */ - public function evaluate() - { - return implode('', parent::evaluate()); - } - - /** - * Evaluate the collection nodes as array - * - * @return array - * @throws FusionException - */ - public function evaluateAsArray() - { - return parent::evaluate(); - } -} diff --git a/Neos.Fusion/Classes/FusionObjects/ArrayImplementation.php b/Neos.Fusion/Classes/FusionObjects/ArrayImplementation.php deleted file mode 100644 index d69590469b2..00000000000 --- a/Neos.Fusion/Classes/FusionObjects/ArrayImplementation.php +++ /dev/null @@ -1,30 +0,0 @@ -getAllowEmpty(); - $attributes = []; - foreach (array_keys($this->properties) as $attributeName) { - if ($attributeName === '__meta' || in_array($attributeName, $this->ignoreProperties)) { - continue; - } - $attributes[$attributeName] = $this->fusionValue($attributeName); - } - return $this->renderAttributes($attributes, $allowEmpty); - } - - /** - * Whether empty attributes (HTML5 syntax) should be allowed - * - * @return boolean - */ - protected function getAllowEmpty() - { - $allowEmpty = $this->fusionValue('__meta/allowEmpty'); - if ($allowEmpty === null) { - return true; - } else { - return (boolean)$allowEmpty; - } - } -} diff --git a/Neos.Fusion/Classes/FusionObjects/CollectionImplementation.php b/Neos.Fusion/Classes/FusionObjects/CollectionImplementation.php deleted file mode 100644 index 7d932fb0b29..00000000000 --- a/Neos.Fusion/Classes/FusionObjects/CollectionImplementation.php +++ /dev/null @@ -1,43 +0,0 @@ -buildView(); - $view->assign('collection', ['element1', 'element2']); - $view->setFusionPath('collection/basicLoop'); - self::assertEquals('Xelement1Xelement2', $view->render()); - } - - /** - * @test - */ - public function basicCollectionWorksAndStillContainsOtherContextVariables() - { - $view = $this->buildView(); - $view->assign('collection', ['element1', 'element2']); - $view->assign('other', 'var'); - $view->setFusionPath('collection/basicLoopOtherContextVariables'); - self::assertEquals('Xelement1varXelement2var', $view->render()); - } - - /** - * @test - */ - public function emptyCollectionReturnsEmptyString() - { - $view = $this->buildView(); - $view->assign('collection', null); - $view->setFusionPath('collection/basicLoop'); - self::assertEquals('', $view->render()); - } - - /** - * @test - */ - public function iterationInformationIsAddedToCollection() - { - $view = $this->buildView(); - $view->assign('collection', ['element1', 'element2', 'element3', 'element4']); - $view->setFusionPath('collection/iteration'); - self::assertEquals('Xelement1-0-1-1--1-Xelement2-1-2----1Xelement3-2-3---1-Xelement4-3-4--1--1', $view->render()); - } -} diff --git a/Neos.Fusion/Tests/Functional/FusionObjects/ConditionsTest.php b/Neos.Fusion/Tests/Functional/FusionObjects/ConditionsTest.php index c596b3a463d..64082cb3fe1 100644 --- a/Neos.Fusion/Tests/Functional/FusionObjects/ConditionsTest.php +++ b/Neos.Fusion/Tests/Functional/FusionObjects/ConditionsTest.php @@ -30,7 +30,6 @@ public function conditionExamples() ['conditions/objectAtLeastOneFalse', null], ['conditions/objectThis', null], ['conditions/dataStructure', ['key' => 'foo', 'nullValue' => null]], - ['conditions/attributes', ' key="foo"'], ['conditions/supportForConditionInProcess', 'wrappedValue'], ['conditions/supportForConditionInProcessFalse', 'originalValue'], ['conditions/supportForConditionInProcessWithAdvancedProcess', 'wrappedValue'], diff --git a/Neos.Fusion/Tests/Functional/FusionObjects/Fixtures/Fusion/Collection.fusion b/Neos.Fusion/Tests/Functional/FusionObjects/Fixtures/Fusion/Collection.fusion deleted file mode 100644 index 1b60c4b562f..00000000000 --- a/Neos.Fusion/Tests/Functional/FusionObjects/Fixtures/Fusion/Collection.fusion +++ /dev/null @@ -1,27 +0,0 @@ -prototype(Neos.Fusion:Collection).@class = 'Neos\\Fusion\\FusionObjects\\CollectionImplementation' -prototype(Neos.Fusion:TestRenderer).@class = 'Neos\\Fusion\\Tests\\Functional\\View\\Fixtures\\TestRenderer' - -collection.basicLoop = Neos.Fusion:Collection { - collection = ${collection} - itemName = 'element' - itemRenderer = Neos.Fusion:TestRenderer { - test = ${element} - } -} - -collection.basicLoopOtherContextVariables = Neos.Fusion:Collection { - collection = ${collection} - itemName = 'element' - itemRenderer = Neos.Fusion:TestRenderer { - test = ${element + other} - } -} - -collection.iteration = Neos.Fusion:Collection { - collection = ${collection} - itemName = 'element' - iterationName = 'iteration' - itemRenderer = Neos.Fusion:TestRenderer { - test = ${element + '-' + iteration.index + '-' + iteration.cycle + '-' + iteration.isFirst + '-' + iteration.isLast + '-' + iteration.isOdd + '-' + iteration.isEven} - } -} diff --git a/Neos.Fusion/Tests/Functional/FusionObjects/Fixtures/Fusion/Conditions.fusion b/Neos.Fusion/Tests/Functional/FusionObjects/Fixtures/Fusion/Conditions.fusion index 97b4d0c2051..1eca7ee64bf 100644 --- a/Neos.Fusion/Tests/Functional/FusionObjects/Fixtures/Fusion/Conditions.fusion +++ b/Neos.Fusion/Tests/Functional/FusionObjects/Fixtures/Fusion/Conditions.fusion @@ -49,12 +49,6 @@ conditions.dataStructure = Neos.Fusion:DataStructure { keyNotSet.@if.cond = false } -conditions.attributes = Neos.Fusion:Attributes { - key = 'foo' - keyNotSet = 'bar' - keyNotSet.@if.cond = false -} - conditions.supportForConditionInProcess = Neos.Fusion:Value { value = 'originalValue' @process.wrap { @@ -92,7 +86,7 @@ conditions.supportForConditionInProcessWithAdvancedProcessFalse = Neos.Fusion:Va conditions.supportForFusionObjectWithSubEvaluationUsedInProcessor = Neos.Fusion:Value { value = 'basic' - theArray = Neos.Fusion:Array { + theArray = Neos.Fusion:Join { something = ' appended' another = Neos.Fusion:Value { value = ' more' diff --git a/Neos.Fusion/Tests/Functional/FusionObjects/Fixtures/Fusion/FusionArray.fusion b/Neos.Fusion/Tests/Functional/FusionObjects/Fixtures/Fusion/FusionArray.fusion deleted file mode 100644 index f21a801b933..00000000000 --- a/Neos.Fusion/Tests/Functional/FusionObjects/Fixtures/Fusion/FusionArray.fusion +++ /dev/null @@ -1,88 +0,0 @@ -prototype(Neos.Fusion:Array).@class = 'Neos\\Fusion\\FusionObjects\\ArrayImplementation' -prototype(Neos.Fusion:TestRenderer).@class = 'Neos\\Fusion\\Tests\\Functional\\View\\Fixtures\\TestRenderer' - -array.basicOrdering = Neos.Fusion:Array { - 100 = Neos.Fusion:TestRenderer - 100.test = 'test100' - - 10 = Neos.Fusion:TestRenderer - 10.test = 'test10' -} - -array.positionalOrdering = Neos.Fusion:Array { - c = Neos.Fusion:TestRenderer - c.test = 'before' - c.@position = '10' - - a = Neos.Fusion:TestRenderer - a.test = 'after' - a.@position = '100' - - f = Neos.Fusion:TestRenderer - f.test = 'middle' - f.@position = '50' -} - -array.startEndOrdering = Neos.Fusion:Array { - a = Neos.Fusion:TestRenderer - a.test = 'after' - a.@position = 'end' - - c = Neos.Fusion:TestRenderer - c.test = 'before' - c.@position = 'start' - - f = Neos.Fusion:TestRenderer - f.test = 'middle' - f.@position = '50' -} - -# expected ordering: -# - e -# - d -# - foobar -# - f -# - g -# - 100 -# - b -# - a -# - c -array.advancedStartEndOrdering = Neos.Fusion:Array { - a = Neos.Fusion:TestRenderer - a.test = 'a' - a.@position = 'end 10' - - b = Neos.Fusion:TestRenderer - b.test = 'b' - b.@position = 'end' - - c = Neos.Fusion:TestRenderer - c.test = 'c' - c.@position = 'end 20' - - d = Neos.Fusion:TestRenderer - d.test = 'd' - d.@position = 'start' - - e = Neos.Fusion:TestRenderer - e.test = 'e' - e.@position = 'start 10' - - f = Neos.Fusion:TestRenderer - f.test = 'f' - f.@position = '50' - - 100 = Neos.Fusion:TestRenderer - 100.test = '100' - - foobar = Neos.Fusion:TestRenderer - foobar.test = 'foobar' - - g = Neos.Fusion:TestRenderer - g.test = 'g' - g.@position = '90' -} - -array.ignoreProperties < array.positionalOrdering { - @ignoreProperties = ${['f']} -} diff --git a/Neos.Fusion/Tests/Functional/FusionObjects/Fixtures/Fusion/NestedOverwritesAndProcessors.fusion b/Neos.Fusion/Tests/Functional/FusionObjects/Fixtures/Fusion/NestedOverwritesAndProcessors.fusion index 3374ef78a2a..4af508a7190 100644 --- a/Neos.Fusion/Tests/Functional/FusionObjects/Fixtures/Fusion/NestedOverwritesAndProcessors.fusion +++ b/Neos.Fusion/Tests/Functional/FusionObjects/Fixtures/Fusion/NestedOverwritesAndProcessors.fusion @@ -1,7 +1,6 @@ prototype(Neos.Fusion:TestRenderer).@class = 'Neos\\Fusion\\Tests\\Functional\\View\\Fixtures\\TestRenderer' prototype(Neos.Fusion:Value).@class = 'Neos\\Fusion\\FusionObjects\\ValueImplementation' prototype(Neos.Fusion:DataStructure).@class = 'Neos\\Fusion\\FusionObjects\\DataStructureImplementation' -prototype(Neos.Fusion:Attributes).@class = 'Neos\\Fusion\\FusionObjects\\AttributesImplementation' prototype(Neos.Fusion:Tag) { # dummy declaration, will be overriden someplace - due to merged import of fixtures. @class = 'Neos\\Fusion\\FusionObjects\\TagImplementation' diff --git a/Neos.Fusion/Tests/Functional/FusionObjects/Fixtures/Fusion/RawCollection.fusion b/Neos.Fusion/Tests/Functional/FusionObjects/Fixtures/Fusion/RawCollection.fusion deleted file mode 100644 index 02343fd90b4..00000000000 --- a/Neos.Fusion/Tests/Functional/FusionObjects/Fixtures/Fusion/RawCollection.fusion +++ /dev/null @@ -1,27 +0,0 @@ -prototype(Neos.Fusion:RawCollection).@class = 'Neos\\Fusion\\FusionObjects\\RawCollectionImplementation' -prototype(Neos.Fusion:TestRenderer).@class = 'Neos\\Fusion\\Tests\\Functional\\View\\Fixtures\\TestRenderer' - -rawCollection.basicLoop = Neos.Fusion:RawCollection { - collection = ${collection} - itemName = 'element' - itemRenderer = Neos.Fusion:TestRenderer { - test = ${element} - } -} - -rawCollection.basicLoopOtherContextVariables = Neos.Fusion:RawCollection { - collection = ${collection} - itemName = 'element' - itemRenderer = Neos.Fusion:TestRenderer { - test = ${element + other} - } -} - -rawCollection.iteration = Neos.Fusion:RawCollection { - collection = ${collection} - itemName = 'element' - iterationName = 'iteration' - itemRenderer = Neos.Fusion:TestRenderer { - test = ${element + '-' + iteration.index + '-' + iteration.cycle + '-' + iteration.isFirst + '-' + iteration.isLast + '-' + iteration.isOdd + '-' + iteration.isEven} - } -} diff --git a/Neos.Fusion/Tests/Functional/FusionObjects/Fixtures/Fusion/Tag.fusion b/Neos.Fusion/Tests/Functional/FusionObjects/Fixtures/Fusion/Tag.fusion index 589c8730216..78021e07fbc 100644 --- a/Neos.Fusion/Tests/Functional/FusionObjects/Fixtures/Fusion/Tag.fusion +++ b/Neos.Fusion/Tests/Functional/FusionObjects/Fixtures/Fusion/Tag.fusion @@ -1,5 +1,4 @@ prototype(Neos.Fusion:DataStructure).@class = 'Neos\\Fusion\\FusionObjects\\DataStructureImplementation' -prototype(Neos.Fusion:Attributes).@class = 'Neos\\Fusion\\FusionObjects\\AttributesImplementation' prototype(Neos.Fusion:DataStructure).@class = 'Neos\\Fusion\\FusionObjects\\DataStructureImplementation' prototype(Neos.Fusion:Tag) { @class = 'Neos\\Fusion\\FusionObjects\\TagImplementation' @@ -34,7 +33,7 @@ tag.arrayAttributes = Neos.Fusion:Tag { } tag.fusionAttributes = Neos.Fusion:Tag { - attributes = Neos.Fusion:Attributes { + attributes = Neos.Fusion:DataStructure { key = 'value' list = ${['foo', 'bar']} } diff --git a/Neos.Fusion/Tests/Functional/FusionObjects/FusionArrayTest.php b/Neos.Fusion/Tests/Functional/FusionObjects/FusionArrayTest.php deleted file mode 100644 index e004fee24e4..00000000000 --- a/Neos.Fusion/Tests/Functional/FusionObjects/FusionArrayTest.php +++ /dev/null @@ -1,74 +0,0 @@ -buildView(); - - $view->setFusionPath('array/basicOrdering'); - self::assertEquals('Xtest10Xtest100', $view->render()); - } - - /** - * @test - */ - public function positionalOrderingWorks() - { - $view = $this->buildView(); - - $view->setFusionPath('array/positionalOrdering'); - self::assertEquals('XbeforeXmiddleXafter', $view->render()); - } - - /** - * @test - */ - public function startEndOrderingWorks() - { - $view = $this->buildView(); - - $view->setFusionPath('array/startEndOrdering'); - self::assertEquals('XbeforeXmiddleXafter', $view->render()); - } - - /** - * @test - */ - public function advancedStartEndOrderingWorks() - { - $view = $this->buildView(); - - $view->setFusionPath('array/advancedStartEndOrdering'); - self::assertEquals('XeXdXfoobarXfXgX100XbXaXc', $view->render()); - } - - /** - * @test - */ - public function ignoredPropertiesWork() - { - $view = $this->buildView(); - - $view->setFusionPath('array/ignoreProperties'); - self::assertEquals('XbeforeXafter', $view->render()); - } -} diff --git a/Neos.Fusion/Tests/Functional/FusionObjects/RawCollectionTest.php b/Neos.Fusion/Tests/Functional/FusionObjects/RawCollectionTest.php deleted file mode 100644 index c5c1aec93b9..00000000000 --- a/Neos.Fusion/Tests/Functional/FusionObjects/RawCollectionTest.php +++ /dev/null @@ -1,65 +0,0 @@ -buildView(); - $view->assign('collection', ['element1', 'element2']); - $view->setFusionPath('rawCollection/basicLoop'); - self::assertEquals(['Xelement1','Xelement2'], $view->render()); - } - - - /** - * @test - */ - public function basicCollectionWorksAndStillContainsOtherContextVariables() - { - $view = $this->buildView(); - $view->assign('collection', ['element1', 'element2']); - $view->assign('other', 'var'); - $view->setFusionPath('rawCollection/basicLoopOtherContextVariables'); - self::assertEquals(['Xelement1var','Xelement2var'], $view->render()); - } - - /** - * @test - */ - public function emptyCollectionReturnsEmptyArray() - { - $view = $this->buildView(); - $view->assign('collection', null); - $view->setFusionPath('rawCollection/basicLoop'); - self::assertEquals([], $view->render()); - } - - /** - * @test - */ - public function iterationInformationIsAddedToCollection() - { - $view = $this->buildView(); - $view->assign('collection', ['element1', 'element2', 'element3', 'element4']); - $view->setFusionPath('rawCollection/iteration'); - self::assertEquals(['Xelement1-0-1-1--1-','Xelement2-1-2----1','Xelement3-2-3---1-','Xelement4-3-4--1--1'], $view->render()); - } -} diff --git a/Neos.Fusion/Tests/Unit/FusionObjects/AttributesImplementationTest.php b/Neos.Fusion/Tests/Unit/FusionObjects/AttributesImplementationTest.php deleted file mode 100644 index 59a374b90a0..00000000000 --- a/Neos.Fusion/Tests/Unit/FusionObjects/AttributesImplementationTest.php +++ /dev/null @@ -1,73 +0,0 @@ -mockRuntime = $this->getMockBuilder(Runtime::class)->disableOriginalConstructor()->getMock(); - } - - public function attributeExamples() - { - return [ - 'null' => [null, ''], - 'empty array' => [[], ''], - 'boolean values' => [['booleanTrueAttribute' => true, 'booleanFalseAttribute' => false], ' booleanTrueAttribute'], - 'empty string value' => [['emptyStringAttribute' => ''], ' emptyStringAttribute'], - 'null value' => [['nullAttribute' => null], ''], - 'simple array' => [['attributeName1' => 'attributeValue1'], ' attributeName1="attributeValue1"'], - 'encoding' => [['spec 'chara>cters'], ' spec<ial="chara>cters"'], - 'array attributes' => [['class' => ['icon', null, 'icon-neos', '']], ' class="icon icon-neos"'], - 'empty attribute value without allowEmpty' => [['emptyStringAttribute' => '', '__meta' => ['allowEmpty' => false]], ' emptyStringAttribute=""'], - ]; - } - - /** - * @test - * @dataProvider attributeExamples - */ - public function evaluateTests($properties, $expectedOutput) - { - $path = 'attributes/test'; - $this->mockRuntime->expects(self::any())->method('evaluate')->will(self::returnCallback(function ($evaluatePath, $that) use ($path, $properties) { - $relativePath = str_replace($path . '/', '', $evaluatePath); - return ObjectAccess::getPropertyPath($properties, str_replace('/', '.', $relativePath)); - })); - - $fusionObjectName = 'Neos.Fusion:Attributes'; - $renderer = new AttributesImplementation($this->mockRuntime, $path, $fusionObjectName); - if ($properties !== null) { - foreach ($properties as $name => $value) { - ObjectAccess::setProperty($renderer, $name, $value); - } - } - - $result = $renderer->evaluate(); - self::assertEquals($expectedOutput, $result); - } -} diff --git a/Neos.Neos/Documentation/References/NeosFusionReference.rst b/Neos.Neos/Documentation/References/NeosFusionReference.rst index 8c344012224..af991b249d7 100644 --- a/Neos.Neos/Documentation/References/NeosFusionReference.rst +++ b/Neos.Neos/Documentation/References/NeosFusionReference.rst @@ -9,17 +9,6 @@ Neos.Fusion This package contains general-purpose Fusion objects, which are usable both within Neos and standalone. -.. _Neos_Fusion__Array: - -Neos.Fusion:Array ------------------ - -:[key]: (string) A nested definition (simple value, expression or object) that evaluates to a string -:[key].@ignoreProperties: (array) A list of properties to ignore from being "rendered" during evaluation -:[key].@position: (string/integer) Define the ordering of the nested definition - -.. note:: The Neos.Fusion:Array object has been renamed to Neos.Fusion:Join the old name is DEPRECATED; - .. _Neos_Fusion__Join: Neos.Fusion:Join @@ -104,57 +93,6 @@ Example of numeric keys (discouraged):: 20 = Neos.NodeTypes:Text } - -.. _Neos_Fusion__Collection: - -Neos.Fusion:Collection ----------------------- - -Render each item in ``collection`` using ``itemRenderer``. - -:collection: (array/Iterable, **required**) The array or iterable to iterate over -:itemName: (string, defaults to ``item``) Context variable name for each item -:itemKey: (string, defaults to ``itemKey``) Context variable name for each item key, when working with array -:iterationName: (string, defaults to ``iterator``) A context variable with iteration information will be available under the given name: ``index`` (zero-based), ``cycle`` (1-based), ``isFirst``, ``isLast`` -:itemRenderer: (string, **required**) The renderer definition (simple value, expression or object) will be called once for every collection element, and its results will be concatenated (if ``itemRenderer`` cannot be rendered the path ``content`` is used as fallback for convenience in afx) - -.. note:: The Neos.Fusion:Collection object is DEPRECATED use Neos.Fusion:Loop instead. - -Example using an object ``itemRenderer``:: - - myCollection = Neos.Fusion:Collection { - collection = ${[1, 2, 3]} - itemName = 'element' - itemRenderer = Neos.Fusion:Template { - templatePath = 'resource://...' - element = ${element} - } - } - - -Example using an expression ``itemRenderer``:: - - myCollection = Neos.Fusion:Collection { - collection = ${[1, 2, 3]} - itemName = 'element' - itemRenderer = ${element * 2} - } - -.. _Neos_Fusion__RawCollection: - -Neos.Fusion:RawCollection -------------------------- - -Render each item in ``collection`` using ``itemRenderer`` and return the result as an array (opposed to *string* for :ref:`Neos_Fusion__Collection`) - -:collection: (array/Iterable, **required**) The array or iterable to iterate over -:itemName: (string, defaults to ``item``) Context variable name for each item -:itemKey: (string, defaults to ``itemKey``) Context variable name for each item key, when working with array -:iterationName: (string, defaults to ``iterator``) A context variable with iteration information will be available under the given name: ``index`` (zero-based), ``cycle`` (1-based), ``isFirst``, ``isLast`` -:itemRenderer: (mixed, **required**) The renderer definition (simple value, expression or object) will be called once for every collection element (if ``itemRenderer`` cannot be rendered the path ``content`` is used as fallback for convenience in afx) - -.. note:: The Neos.Fusion:RawCollection object is DEPRECATED use Neos.Fusion:Map instead.** - .. _Neos_Fusion__Loop: Neos.Fusion:Loop @@ -194,7 +132,7 @@ Example using an expression ``itemRenderer``:: Neos.Fusion:Map --------------- -Render each item in ``items`` using ``itemRenderer`` and return the result as an array (opposed to *string* for :ref:`Neos_Fusion__Collection`) +Render each item in ``items`` using ``itemRenderer`` and return the result as an array (opposed to *string* for :ref:`Neos_Fusion__Join`) :items: (array/Iterable, **required**) The array or iterable to iterate over (to calculate ``iterator.isLast`` items have to be ``countable``) :itemName: (string, defaults to ``item``) Context variable name for each item @@ -256,7 +194,7 @@ Simple Example:: } } -The ordering of matcher definitions can be specified with the ``@position`` property (see :ref:`Neos_Fusion__Array`). +The ordering of matcher definitions can be specified with the ``@position`` property (see :ref:`Neos_Fusion__Join`). Thus, the priority of existing matchers (e.g. the default Neos document rendering) can be changed by setting or overriding the ``@position`` property. @@ -536,27 +474,13 @@ Example:: value = ${1+2} } -.. _Neos_Fusion__RawArray: - -Neos.Fusion:RawArray --------------------- - -Evaluate nested definitions as an array (opposed to *string* for :ref:`Neos_Fusion__Array`) - -:[key]: (mixed) A nested definition (simple value, expression or object), ``[key]`` will be used for the resulting array key -:[key].@position: (string/integer) Define the ordering of the nested definition - -.. tip:: For simple cases an expression with an array literal ``${[1, 2, 3]}`` might be easier to read - -.. note:: The Neos.Fusion:RawArray object has been renamed to Neos.Fusion:DataStructure the old name is DEPRECATED; - .. _Neos_Fusion__Tag: Neos.Fusion:DataStructure -------------------- -Evaluate nested definitions as an array (opposed to *string* for :ref:`Neos_Fusion__Array`) +Evaluate nested definitions as an array (opposed to *string* for :ref:`Neos_Fusion__Join`) :[key]: (mixed) A nested definition (simple value, expression or object), ``[key]`` will be used for the resulting array key :[key].@position: (string/integer) Define the ordering of the nested definition @@ -596,54 +520,16 @@ Evaluates to:: -.. _Neos_Fusion__Attributes: - -Neos.Fusion:Attributes ----------------------- - -A Fusion object to render HTML tag attributes. This object is used by the :ref:`Neos_Fusion__Tag` object to -render the attributes of a tag. But it's also useful standalone to render extensible attributes in a Fluid template. - -:[key]: (string) A single attribute, array values are joined with whitespace. Boolean values will be rendered as an empty or absent attribute. -:@allowEmpty: (boolean) Whether empty attributes (HTML5 syntax) should be used for empty, false or null attribute values - -.. note:: The ``Neos.Fusion:Attributes`` object is DEPRECATED in favor of a solution inside Neos.Fusion:Tag which takes attributes - as ``Neos.Fusion:DataStructure`` now. If you have to render attributes as string without a tag you can use - ``Neos.Fusion:Join`` with ``@glue` but you will have to concatenate array attributes yourself. - -Example: -^^^^^^^^ - -:: - - attributes = Neos.Fusion:Attributes { - foo = 'bar' - class = Neos.Fusion:DataStructure { - class1 = 'class1' - class2 = 'class2' - } - } - -Evaluates to:: - - foo="bar" class="class1 class2" - -Unsetting an attribute: -^^^^^^^^^^^^^^^^^^^^^^^ - -It's possible to unset an attribute by assigning ``false`` or ``${null}`` as a value. No attribute will be rendered for -this case. - .. _Neos_Fusion__Http_Message: Neos.Fusion:Http.Message ------------------------ -A prototype based on :ref:`Neos_Fusion__Array` for rendering an HTTP message (response). It should be used to +A prototype based on :ref:`Neos_Fusion__Join` for rendering an HTTP message (response). It should be used to render documents since it generates a full HTTP response and allows to override the HTTP status code and headers. -:httpResponseHead: (:ref:`Neos_Fusion__Http_ResponseHead`) An HTTP response head with properties to adjust the status and headers, the position in the ``Array`` defaults to the very beginning -:[key]: (string) A nested definition (see :ref:`Neos_Fusion__Array`) +:httpResponseHead: (:ref:`Neos_Fusion__Http_ResponseHead`) An HTTP response head with properties to adjust the status and headers, the position in the ``Join`` defaults to the very beginning +:[key]: (string) A nested definition (see :ref:`Neos_Fusion__Join`) Example: ^^^^^^^^ @@ -725,35 +611,6 @@ Link to backend modules (other than `content`):: } } -.. _Neos_Fusion__UriBuilder: - -Neos.Fusion:UriBuilder ----------------------- - -Built a URI to a controller action - -:package: (string) The package key (e.g. ``'My.Package'``) -:subpackage: (string) The subpackage, empty by default -:controller: (string) The controller name (e.g. ``'Registration'``) -:action: (string) The action name (e.g. ``'new'``) -:arguments: (array) Arguments to the action by named key -:format: (string) An optional request format (e.g. ``'html'``) -:section: (string) An optional fragment (hash) for the URI -:additionalParams: (array) Additional URI query parameters by named key -:addQueryString: (boolean) Whether to keep the query parameters of the current URI -:argumentsToBeExcludedFromQueryString: (array) Query parameters to exclude for ``addQueryString`` -:absolute: (boolean) Whether to create an absolute URI - -.. note:: The use of ``Neos.Fusion:UriBuilder`` is deprecated. Use :ref:`_Neos_Fusion__ActionUri` instead. - -Example:: - - uri = Neos.Fusion:UriBuilder { - package = 'My.Package' - controller = 'Registration' - action = 'new' - } - .. _Neos_Fusion__ResourceUri: Neos.Fusion:ResourceUri @@ -873,22 +730,22 @@ which do not need a particular node type to work on. Neos.Neos:Page -------------- -Subclass of :ref:`Neos_Fusion__Http_Message`, which is based on :ref:`Neos_Fusion__Array`. Main entry point +Subclass of :ref:`Neos_Fusion__Http_Message`, which is based on :ref:`Neos_Fusion__Join`. Main entry point into rendering a page; responsible for rendering the ```` tag and everything inside. :doctype: (string) Defaults to ```` :htmlTag: (:ref:`Neos_Fusion__Tag`) The opening ```` tag -:htmlTag.attributes: (:ref:`Neos_Fusion__Attributes`) Attributes for the ```` tag +:htmlTag.attributes: (:ref:`Neos_Fusion__DataStructure`) Attributes for the ```` tag :headTag: (:ref:`Neos_Fusion__Tag`) The opening ```` tag -:head: (:ref:`Neos_Fusion__Array`) HTML markup for the ```` tag +:head: (:ref:`Neos_Fusion__Join`) HTML markup for the ```` tag :head.titleTag: (:ref:`Neos_Fusion__Tag`) The ```` tag -:head.javascripts: (:ref:`Neos_Fusion__Array`) Script includes in the head should go here -:head.stylesheets: (:ref:`Neos_Fusion__Array`) Link tags for stylesheets in the head should go here +:head.javascripts: (:ref:`Neos_Fusion__Join`) Script includes in the head should go here +:head.stylesheets: (:ref:`Neos_Fusion__Join`) Link tags for stylesheets in the head should go here :body.templatePath: (string) Path to a fluid template for the page body :bodyTag: (:ref:`Neos_Fusion__Tag`) The opening ``<body>`` tag -:bodyTag.attributes: (:ref:`Neos_Fusion__Attributes`) Attributes for the ``<body>`` tag +:bodyTag.attributes: (:ref:`Neos_Fusion__DataStructure`) Attributes for the ``<body>`` tag :body: (:ref:`Neos_Fusion__Template`) HTML markup for the ``<body>`` tag -:body.javascripts: (:ref:`Neos_Fusion__Array`) Body footer JavaScript includes +:body.javascripts: (:ref:`Neos_Fusion__Join`) Body footer JavaScript includes :body.[key]: (mixed) Body template variables Examples: @@ -958,7 +815,7 @@ Render nested content from a ``ContentCollection`` node. Individual nodes are re :nodePath: (string, **required**) The relative node path of the ``ContentCollection`` (e.g. ``'main'``) :@context.node: (Node) The content collection node, resolved from ``nodePath`` by default :tagName: (string) Tag name for the wrapper element -:attributes: (:ref:`Neos_Fusion__Attributes`) Tag attributes for the wrapper element +:attributes: (:ref:`Neos_Fusion__DataStructure`) Tag attributes for the wrapper element Example:: @@ -1025,7 +882,7 @@ auto-generated Fusion to define prototypes for each node type extending ``Neos.N :templatePath: (string) The template path and filename, defaults to ``'resource://[packageKey]/Private/Templates/NodeTypes/[nodeType].html'`` (for auto-generated prototypes) :[key]: (mixed) Template variables, all node type properties are available by default (for auto-generated prototypes) -:attributes: (:ref:`Neos_Fusion__Attributes`) Extensible attributes, used in the default templates +:attributes: (:ref:`Neos_Fusion__DataStructure`) Extensible attributes, used in the default templates Example:: @@ -1119,10 +976,10 @@ Render a menu with items for nodes. Extends :ref:`Neos_Fusion__Template`. :filter: (string) Filter items by node type (e.g. ``'!My.Site:News,Neos.Neos:Document'``), defaults to ``'Neos.Neos:Document'`` :renderHiddenInIndex: (boolean) Whether nodes with ``hiddenInIndex`` should be rendered, defaults to ``false`` :itemCollection: (array) Explicitly set the Node items for the menu (alternative to ``startingPoints`` and levels) -:attributes: (:ref:`Neos_Fusion__Attributes`) Extensible attributes for the whole menu -:normal.attributes: (:ref:`Neos_Fusion__Attributes`) Attributes for normal state -:active.attributes: (:ref:`Neos_Fusion__Attributes`) Attributes for active state -:current.attributes: (:ref:`Neos_Fusion__Attributes`) Attributes for current state +:attributes: (:ref:`Neos_Fusion__DataStructure`) Extensible attributes for the whole menu +:normal.attributes: (:ref:`Neos_Fusion__DataStructure`) Attributes for normal state +:active.attributes: (:ref:`Neos_Fusion__DataStructure`) Attributes for active state +:current.attributes: (:ref:`Neos_Fusion__DataStructure`) Attributes for current state .. note:: The ``items`` of the ``Menu`` are internally calculated with the prototype :ref:`Neos_Neos__MenuItems` which you can use directly aswell. @@ -1456,7 +1313,7 @@ Renders an anchor tag pointing to the node given via the argument. Based on :ref The link text is the node label, unless overridden. :\*: All :ref:`Neos_Neos__NodeUri` properties -:attributes: (:ref:`Neos_Fusion__Attributes`) Link tag attributes +:attributes: (:ref:`Neos_Fusion__DataStructure`) Link tag attributes :content: (string) The label of the link, defaults to ``node.label``. Example:: @@ -1505,7 +1362,7 @@ Neos.Neos:ImageTag Render an image tag for an asset. :\*: All :ref:`Neos_Neos__ImageUri` properties -:attributes: (:ref:`Neos_Fusion__Attributes`) Image tag attributes +:attributes: (:ref:`Neos_Fusion__DataStructure`) Image tag attributes Per default, the attribute loading is set to ``'lazy'``. To fetch a resource immediately, you can set ``attributes.loading`` to ``null``, ``false`` or ``'eager'``. @@ -1587,3 +1444,57 @@ Example:: property = 'title' } } + + +Deprecated Fusion Prototypes +---------------------------- + +The following prototypes are deprecated and will be removed in future versions of Neos! + +.. _Neos_Fusion__UriBuilder: + +Neos.Fusion:UriBuilder +~~~~~~~~~~~~~~~~~~~~~~ + +Built a URI to a controller action + +:package: (string) The package key (e.g. ``'My.Package'``) +:subpackage: (string) The subpackage, empty by default +:controller: (string) The controller name (e.g. ``'Registration'``) +:action: (string) The action name (e.g. ``'new'``) +:arguments: (array) Arguments to the action by named key +:format: (string) An optional request format (e.g. ``'html'``) +:section: (string) An optional fragment (hash) for the URI +:additionalParams: (array) Additional URI query parameters by named key +:addQueryString: (boolean) Whether to keep the query parameters of the current URI +:argumentsToBeExcludedFromQueryString: (array) Query parameters to exclude for ``addQueryString`` +:absolute: (boolean) Whether to create an absolute URI + +.. note:: The use of ``Neos.Fusion:UriBuilder`` is deprecated. Use :ref:`_Neos_Fusion__ActionUri` instead. + +Example:: + + uri = Neos.Fusion:UriBuilder { + package = 'My.Package' + controller = 'Registration' + action = 'new' + } + +Removed Fusion Prototypes +------------------------- + +The following Fusion Prototypes have been removed: + +.. _Neos_Fusion__Array: +* `Neos.Fusion:Array` replaced with :ref:`_Neos_Fusion__Join` +.. _Neos_Fusion__RawArray: +* `Neos.Fusion:RawArray` replaced with :ref:`_Neos_Fusion__DataStructure` +.. _Neos_Fusion__Collection: +* `Neos.Fusion:Collection` replaced with :ref:`_Neos_Fusion__Loop` +.. _Neos_Fusion__RawCollection: +* `Neos.Fusion:RawCollection` replaced with :ref:`_Neos_Fusion__Map` +.. _Neos_Fusion__Attributes: +* `Neos.Fusion:Attributes` use property `attributes` in :ref:`_Neos_Fusion__Tag` + + + diff --git a/Neos.Neos/Resources/Private/Fusion/Backend/History/Root.fusion b/Neos.Neos/Resources/Private/Fusion/Backend/History/Root.fusion index 23fa6fde2f8..c857f50544a 100644 --- a/Neos.Neos/Resources/Private/Fusion/Backend/History/Root.fusion +++ b/Neos.Neos/Resources/Private/Fusion/Backend/History/Root.fusion @@ -28,12 +28,12 @@ prototype(Neos.Neos:History.EventRenderer) < prototype(Neos.Fusion:Case) { # Node events # -prototype(Neos.Neos:History.NodeEventRenderer) < prototype(Neos.Fusion:Array) { +prototype(Neos.Neos:History.NodeEventRenderer) < prototype(Neos.Fusion:Join) { @context.documentEventsByType = ${Neos.Array.groupBy(Neos.Array.filter(event.childEvents, 'documentEvent'), 'eventType')} @context.contentEventsByType = ${Neos.Array.groupBy(Neos.Array.filterNegated(event.childEvents, 'documentEvent'), 'eventType')} - documentEvents = Neos.Fusion:Collection { - collection = ${documentEventsByType} + documentEvents = Neos.Fusion:Loop { + items = ${documentEventsByType} itemName = 'eventsOfMatchedType' itemRenderer = Neos.Fusion:Case { diff --git a/Neos.Neos/Resources/Private/Fusion/Prototypes/Content.fusion b/Neos.Neos/Resources/Private/Fusion/Prototypes/Content.fusion index ced9c9d367f..f86689e8b42 100644 --- a/Neos.Neos/Resources/Private/Fusion/Prototypes/Content.fusion +++ b/Neos.Neos/Resources/Private/Fusion/Prototypes/Content.fusion @@ -8,7 +8,7 @@ prototype(Neos.Neos:Content) < prototype(Neos.Fusion:Template) { node = ${node} - attributes = Neos.Fusion:Attributes + attributes = Neos.Fusion:DataStructure attributes.class = '' # The following is used to automatically append a class attribute that reflects the underlying node type of a Fusion object, diff --git a/Neos.Neos/Resources/Private/Fusion/Prototypes/DimensionsMenu.fusion b/Neos.Neos/Resources/Private/Fusion/Prototypes/DimensionsMenu.fusion index bba25da41a0..f5ded703887 100644 --- a/Neos.Neos/Resources/Private/Fusion/Prototypes/DimensionsMenu.fusion +++ b/Neos.Neos/Resources/Private/Fusion/Prototypes/DimensionsMenu.fusion @@ -3,7 +3,7 @@ prototype(Neos.Neos:DimensionsMenu) < prototype(Neos.Neos:Menu) { templatePath = 'resource://Neos.Neos/Private/Templates/FusionObjects/DimensionsMenu.html' # the "absent" state is assigned to items for dimension (combinations) for which no node variant exists - absent.attributes = Neos.Fusion:Attributes { + absent.attributes = Neos.Fusion:DataStructure { class = 'normal' } diff --git a/Neos.Neos/Resources/Private/Fusion/Prototypes/Menu.fusion b/Neos.Neos/Resources/Private/Fusion/Prototypes/Menu.fusion index 69b7a76c866..570b9af36d0 100644 --- a/Neos.Neos/Resources/Private/Fusion/Prototypes/Menu.fusion +++ b/Neos.Neos/Resources/Private/Fusion/Prototypes/Menu.fusion @@ -13,15 +13,15 @@ prototype(Neos.Neos:Menu) < prototype(Neos.Fusion:Template) { node = ${node} - attributes = Neos.Fusion:Attributes + attributes = Neos.Fusion:DataStructure - active.attributes = Neos.Fusion:Attributes { + active.attributes = Neos.Fusion:DataStructure { class = 'active' } - current.attributes = Neos.Fusion:Attributes { + current.attributes = Neos.Fusion:DataStructure { class = 'current' } - normal.attributes = Neos.Fusion:Attributes { + normal.attributes = Neos.Fusion:DataStructure { class = 'normal' } diff --git a/Neos.NodeTypes.ColumnLayouts/Resources/Private/Fusion/Root.fusion b/Neos.NodeTypes.ColumnLayouts/Resources/Private/Fusion/Root.fusion index 95f85155b50..1753ad0c689 100644 --- a/Neos.NodeTypes.ColumnLayouts/Resources/Private/Fusion/Root.fusion +++ b/Neos.NodeTypes.ColumnLayouts/Resources/Private/Fusion/Root.fusion @@ -15,7 +15,7 @@ prototype(Neos.NodeTypes.ColumnLayouts:MultiColumn) < prototype(Neos.Neos:Conten # Abstract render definition for a single content column in a multi column element prototype(Neos.NodeTypes.ColumnLayouts:MultiColumnItem) < prototype(Neos.Neos:ContentCollection) { nodePath = '.' - attributes = Neos.Fusion:Attributes { + attributes = Neos.Fusion:DataStructure { class = 'column' } } diff --git a/Neos.NodeTypes.Navigation/Resources/Private/Fusion/Root.fusion b/Neos.NodeTypes.Navigation/Resources/Private/Fusion/Root.fusion index b4c1a4b2e40..16771aba7bb 100644 --- a/Neos.NodeTypes.Navigation/Resources/Private/Fusion/Root.fusion +++ b/Neos.NodeTypes.Navigation/Resources/Private/Fusion/Root.fusion @@ -14,13 +14,13 @@ prototype(Neos.NodeTypes.Navigation:Navigation) < prototype(Neos.Neos:Menu) { attributes.class.@process.nodeType = ${Array.push(value, String.toLowerCase(String.pregReplace(node.nodeTypeName.value, '/[[:^alnum:]]/', '-')))} - active.attributes = Neos.Fusion:Attributes { + active.attributes = Neos.Fusion:DataStructure { class = 'active' } - current.attributes = Neos.Fusion:Attributes { + current.attributes = Neos.Fusion:DataStructure { class = 'current' } - normal.attributes = Neos.Fusion:Attributes { + normal.attributes = Neos.Fusion:DataStructure { class = 'normal' }