All page names need to be in English.
en da  de  fr  it  ja  km  nl  ru  zh

EEL Cookbook

From TYPO3Wiki
Jump to: navigation, search

This cookbook highlight some EEL snippets for Flow TYPO3 Flow / Neos TypoScript2

Slide up a property with EEL

How to get a parent page in the current rootline with a defined property set with TypoScript2 / EEL for TYPO3 Neos.

${q(node).add(q(node).parents('[backgroundImage]')).filter('[backgroundImage][backgroundImage != ""]').first().property('backgroundImage')}

This EEL expression fetches:

  1. The current node
  2. ...adds all parent nodes having a property backgroundImage
  3. ...filters that collection again by those nodes having that property *and* having that property value != "" (the current node could not have that property, that's why we filter it again)
  4. ...gets the first node (remember: the node collection is in ascending order from the current node towards the site root node)
  5. ...and finally gets the property in question

(for direct comparison:)

  1. ${q(node)
  2. .add(q(node).parents('[backgroundImage]'))
  3. .filter('[backgroundImage][backgroundImage != ""]')
  4. .first()
  5. .property('backgroundImage')}

Check if the current node is below a node subtree

This is actually an alternative for the TypoScript condition 'PIDinRootline' but extended with a check on a particular level. Let's say we want to check if the current node is below the path /en/ on our site. For that you can use the following expression:

${q(node).parents().slice(-2, -1).property('_name') == 'en'}

This will check if the name of the last node in the rootline before the actual root has the name 'en'.