mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
42 lines
696 B
PHP
42 lines
696 B
PHP
|
<?php
|
||
|
/**
|
||
|
* Moved to seperate file for caching reasons
|
||
|
*/
|
||
|
class Tab extends CompositeField {
|
||
|
protected $tabSet;
|
||
|
|
||
|
public function __construct($title) {
|
||
|
$args = func_get_args();
|
||
|
$this->title = array_shift($args);
|
||
|
$this->id = ereg_replace('[^0-9A-Za-z]+', '', $this->title);
|
||
|
|
||
|
parent::__construct($args);
|
||
|
}
|
||
|
|
||
|
public function id() {
|
||
|
return $this->tabSet->id() . '_' . $this->id;
|
||
|
}
|
||
|
|
||
|
public function Fields() {
|
||
|
return $this->children;
|
||
|
}
|
||
|
|
||
|
public function setTabSet($val) {
|
||
|
$this->tabSet = $val;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Returns the named field
|
||
|
*/
|
||
|
public function fieldByName($name) {
|
||
|
foreach($this->children as $child) {
|
||
|
if($name == $child->Name) return $child;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
?>
|