mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
ENHANCEMENT addExtraClass() support for Tab and TabSet
This commit is contained in:
parent
c507efcfad
commit
6d999aa6ba
@ -67,5 +67,19 @@ class Tab extends CompositeField {
|
||||
if($name == $child->getName()) return $child;
|
||||
}
|
||||
}
|
||||
|
||||
public function extraClass() {
|
||||
return implode(' ', (array)$this->extraClasses);
|
||||
}
|
||||
|
||||
public function getAttributes() {
|
||||
return array_merge(
|
||||
$this->attributes,
|
||||
array(
|
||||
'id' => $this->id(),
|
||||
'class' => 'tab ' . $this->extraClass()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,6 +103,16 @@ class TabSet extends CompositeField {
|
||||
if(isset($this->tabSet)) return $this->tabSet;
|
||||
}
|
||||
|
||||
public function getAttributes() {
|
||||
return array_merge(
|
||||
$this->attributes,
|
||||
array(
|
||||
'id' => $this->id(),
|
||||
'class' => 'ss-tabset ' . $this->extraClass()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the named tab
|
||||
*/
|
||||
|
@ -1,12 +1,12 @@
|
||||
<div class="ss-tabset" id="$id">
|
||||
<div $AttributesHTML>
|
||||
<ul>
|
||||
<% control Tabs %>
|
||||
<li class="$FirstLast $MiddleString"><a href="#$id" id="tab-$id">$Title</a></li>
|
||||
<li class="$FirstLast $MiddleString $extraClass"><a href="#$id" id="tab-$id">$Title</a></li>
|
||||
<% end_control %>
|
||||
</ul>
|
||||
|
||||
<% control Tabs %>
|
||||
<div class="tab" id="$id">
|
||||
<div $AttributesHTML>
|
||||
<% if Tabs %>
|
||||
$FieldHolder
|
||||
<% else %>
|
||||
|
Loading…
Reference in New Issue
Block a user