Neos\FluidAdaptor\ViewHelpers\Format\IdentifierViewHelper::render PHP Method

render() public method

Outputs the identifier of the specified object
public render ( object $value = null ) : mixed
$value object the object to render the identifier for, or NULL if VH children should be used
return mixed the identifier of $value, usually the UUID
    public function render($value = null)
    {
        if ($value === null) {
            $value = $this->renderChildren();
        }
        if ($value === null) {
            return null;
        }
        if (!is_object($value)) {
            throw new ViewHelper\Exception('f:format.identifier expects an object, ' . gettype($value) . ' given.', 1337700024);
        }
        return $this->persistenceManager->getIdentifierByObject($value);
    }

Usage Example

 /**
  * @test
  * @expectedException \Neos\FluidAdaptor\Core\ViewHelper\Exception
  */
 public function renderThrowsExceptionIfGivenValueIsNoObject()
 {
     $notAnObject = array();
     $this->viewHelper->render($notAnObject);
 }
IdentifierViewHelper