Neos\FluidAdaptor\ViewHelpers\Form\AbstractFormViewHelper::renderHiddenIdentityField PHP Method

renderHiddenIdentityField() protected method

Renders a hidden form field containing the technical identity of the given object.
See also: Neos\Flow\Mvc\Controller\Argument::setValue()
protected renderHiddenIdentityField ( object $object, string $name ) : string
$object object Object to create the identity field for
$name string 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
    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);
    }