/**
  * 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 ($this->hasArgument('data') && is_array($this->arguments['data'])) {
         foreach ($this->arguments['data'] as $dataAttributeKey => $dataAttributeValue) {
             $this->tag->addAttribute('data-' . $dataAttributeKey, $dataAttributeValue);
         }
     }
     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]);
             }
         }
     }
 }
コード例 #2
0
ファイル: RouteViewHelper.php プロジェクト: mia3/fluidbundle
 /**
  * @return string
  */
 public function render()
 {
     return $this->tag->render();
 }