/**
  * 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]);
             }
         }
     }
 }
 /**
  * Handles additional arguments, sorting out any data-
  * prefixed tag attributes and assigning them. Then passes
  * the unassigned arguments to the parent class' method,
  * which in the default implementation will throw an error
  * about "undeclared argument used".
  *
  * @param array $arguments
  * @return void
  */
 public function handleAdditionalArguments(array $arguments)
 {
     $unassigned = array();
     foreach ($arguments as $argumentName => $argumentValue) {
         if (strpos($argumentName, 'data-') === 0) {
             $this->tag->addAttribute($argumentName, $argumentValue);
         } else {
             $unassigned[$argumentName] = $argumentValue;
         }
     }
     parent::handleAdditionalArguments($unassigned);
 }
 /**
  * setOptions
  *
  * Set the view helpers options.
  *
  * @param  array $options
  *
  * @return $this
  */
 public function setOptions($options)
 {
     if (isset($options['attributes'])) {
         $this->setAttributes($options['attributes']);
         unset($options['attributes']);
     }
     if (isset($options['open_tag_format'])) {
         $this->setOpenTagFormat($options['open_tag_format']);
         unset($options['open_tag_format']);
     }
     if (isset($options['close_tag_format'])) {
         $this->setCloseTagFormat($options['close_tag_format']);
         unset($options['close_tag_format']);
     }
     return parent::setOptions($options);
 }