/**
* Renders a hidden form field containing the technical identity of the given object.
*
* @param object $object Object to create the identity field for
* @param string $name Name
* @return string A hidden field containing the Identity (UUID in Flow) of the given object or NULL if the object is unknown to the persistence framework
* @see \Neos\Flow\Mvc\Controller\Argument::setValue()
*/
protected function renderHiddenIdentityField($object, $name)
{
if (!is_object($object) || $this->persistenceManager->isNewObject($object)) {
return '';
}
$identifier = $this->persistenceManager->getIdentifierByObject($object);
if ($identifier === null) {
return chr(10) . '<!-- Object of type ' . get_class($object) . ' is without identity -->' . chr(10);
}
$name = $this->prefixFieldName($name) . '[__identity]';
$this->registerFieldNameForFormTokenGeneration($name);
return chr(10) . '<input type="hidden" name="' . $name . '" value="' . $identifier . '" />' . chr(10);
}