Neos\Fusion\TypoScriptObjects\RendererImplementation::evaluate PHP Method

evaluate() public method

Render $type and return it.
public evaluate ( ) : mixed
return mixed
    public function evaluate()
    {
        $rendererPath = sprintf('%s/renderer', $this->path);
        $canRenderWithRenderer = $this->tsRuntime->canRender($rendererPath);
        $renderPath = $this->getRenderPath();
        if ($canRenderWithRenderer) {
            $renderedElement = $this->tsRuntime->evaluate($rendererPath, $this);
        } elseif ($renderPath !== null) {
            if (substr($renderPath, 0, 1) === '/') {
                $renderedElement = $this->tsRuntime->render(substr($renderPath, 1));
            } else {
                $renderedElement = $this->tsRuntime->render($this->path . '/' . str_replace('.', '/', $renderPath));
            }
        } else {
            $renderedElement = $this->tsRuntime->render(sprintf('%s/element<%s>', $this->path, $this->getType()));
        }
        return $renderedElement;
    }

Usage Example

 /**
  * If $condition matches, render $type and return it. Else, return MATCH_NORESULT.
  *
  * @return mixed
  */
 public function evaluate()
 {
     if ($this->getCondition()) {
         return parent::evaluate();
     } else {
         return CaseImplementation::MATCH_NORESULT;
     }
 }