Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ENHANCEMENT addExtraClass() support for Tab and TabSet

  • Loading branch information...
commit 6d999aa6bafe01d289bae8beed9c6ca7c5546b3c 1 parent c507efc
@chillu chillu authored
Showing with 27 additions and 3 deletions.
  1. +14 −0 forms/Tab.php
  2. +10 −0 forms/TabSet.php
  3. +3 −3 templates/forms/TabSet.ss
View
14 forms/Tab.php
@@ -67,5 +67,19 @@ public function fieldByName($name) {
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()
+ )
+ );
+ }
}
View
10 forms/TabSet.php
@@ -102,6 +102,16 @@ public function setTabSet($val) {
public function getTabSet() {
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
View
6 templates/forms/TabSet.ss
@@ -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 %>
Please sign in to comment.
Something went wrong with that request. Please try again.