/** * Renders hidden form fields for referrer information about * the current request. * * @return string Hidden fields with referrer information */ protected function renderHiddenReferrerFields() { $tagBuilder = new TagBuilder('input'); $tagBuilder->addAttribute('type', 'hidden'); $tagBuilder->addAttribute('name', $this->prefixFieldName('__state')); $serializedFormState = base64_encode(serialize($this->arguments['object']->getFormState())); $tagBuilder->addAttribute('value', $this->hashService->appendHmac($serializedFormState)); return $tagBuilder->render(); }
/** * Sets the tag name to $this->tagName. * Additionally, sets all tag attributes which were registered in * $this->tagAttributes and additionalArguments. * * Will be invoked just before the render method. * * @return void * @api */ public function initialize() { parent::initialize(); $this->tag->reset(); $this->tag->setTagName($this->tagName); if ($this->hasArgument('additionalAttributes') && is_array($this->arguments['additionalAttributes'])) { $this->tag->addAttributes($this->arguments['additionalAttributes']); } if (isset(self::$tagAttributes[get_class($this)])) { foreach (self::$tagAttributes[get_class($this)] as $attributeName) { if ($this->hasArgument($attributeName) && $this->arguments[$attributeName] !== '') { $this->tag->addAttribute($attributeName, $this->arguments[$attributeName]); } } } }