コード例 #1
0
 /**
  * Evaluate an Eel expression.
  *
  * @param string $expression The Eel expression to evaluate
  * @param NodeInterface $node
  * @param string $propertyName
  * @param mixed $value
  * @return mixed The result of the evaluated Eel expression
  * @throws \TYPO3\Eel\Exception
  */
 protected function evaluateEelExpression($expression, NodeInterface $node, $propertyName, $value)
 {
     if ($this->defaultContextVariables === NULL) {
         $this->defaultContextVariables = EelUtility::getDefaultContextVariables($this->settings['defaultContext']);
     }
     $contextVariables = array_merge($this->defaultContextVariables, array('node' => $node, 'propertyName' => $propertyName, 'value' => $value));
     return EelUtility::evaluateEelExpression($expression, $this->eelEvaluator, $contextVariables);
 }
コード例 #2
0
 /**
  * Get variables from configuration that should be set in the context by default.
  * For example Eel helpers are made available by this.
  *
  * @return array Array with default context variable objects.
  */
 protected function getDefaultContextVariables()
 {
     if ($this->defaultContextVariables === null) {
         $this->defaultContextVariables = array();
         if (isset($this->settings['defaultContext']) && is_array($this->settings['defaultContext'])) {
             $this->defaultContextVariables = EelUtility::getDefaultContextVariables($this->settings['defaultContext']);
         }
         $this->defaultContextVariables['request'] = $this->controllerContext->getRequest();
     }
     return $this->defaultContextVariables;
 }
 /**
  * @param AbstractNodeData $nodeData
  * @param NodeType $nodeType
  * @param MetaDataCollection $metaDataCollection
  * @throws \TYPO3\Eel\Exception
  */
 protected function mapMetaDataToNodeData(AbstractNodeData $nodeData, NodeType $nodeType, MetaDataCollection $metaDataCollection)
 {
     if ($this->defaultContextVariables === NULL) {
         $this->defaultContextVariables = EelUtility::getDefaultContextVariables($this->settings['defaultEelContext']);
     }
     foreach ($nodeType->getProperties() as $propertyName => $propertyConfiguration) {
         $contextVariables = array_merge($this->defaultContextVariables, $metaDataCollection->toArray());
         if (isset($propertyConfiguration['mapping'])) {
             $nodeData->setProperty($propertyName, EelUtility::evaluateEelExpression($propertyConfiguration['mapping'], $this->eelEvaluator, $contextVariables));
         }
     }
 }
コード例 #4
0
 public function initializeObject()
 {
     if ($this->defaultContextVariables === null) {
         $this->defaultContextVariables = EelUtility::getDefaultContextVariables($this->defaultEelContext);
     }
 }