Widget/Tab: Allow additional a tag attributes

refs #4823
This commit is contained in:
Eric Lippmann 2013-10-10 11:33:14 +02:00
parent c67ef17e86
commit d479ab3536

View File

@ -96,6 +96,13 @@ class Tab implements Widget
*/ */
private $iconCls = null; private $iconCls = null;
/**
* Additional a tag attributes
*
* @var array
*/
private $tagParams;
/** /**
* Sets an icon image for this tab * Sets an icon image for this tab
* *
@ -166,6 +173,16 @@ class Tab implements Widget
$this->urlParams = $urlParams; $this->urlParams = $urlParams;
} }
/**
* Set additional a tag attributes
*
* @param array $tagParams
*/
public function setTagParams(array $tagParams)
{
$this->tagParams = $tagParams;
}
/** /**
* Create a new Tab with the given properties * Create a new Tab with the given properties
* *
@ -215,7 +232,13 @@ class Tab implements Widget
} }
if ($this->url !== null) { if ($this->url !== null) {
$this->url->overwriteParams($this->urlParams); $this->url->overwriteParams($this->urlParams);
$tab = '<a href="' . $this->url->getAbsoluteUrl() . '">' . $caption . '</a>'; $tagParams = '';
if ($this->tagParams !== null) {
foreach ($this->tagParams as $key => $value) {
$tagParams .= ' ' . $key . '="' . $value . '"';
}
}
$tab = '<a' . $tagParams .' href="' . $this->url->getAbsoluteUrl() . '">' . $caption . '</a>';
} else { } else {
$tab = $caption; $tab = $caption;
} }