silverstripe-framework/forms/Tab.php
Ingo Schommer 8fd1a33d84 (merged from branches/roa. use "svn log -c <changeset> -g <module-svn-path>" for detailed commit message)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@60227 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-08-09 05:57:44 +00:00

47 lines
833 B
PHP
Executable File

<?php
/**
* Implements a single tab in a {@link TabSet}.
* @package forms
* @subpackage fields-structural
*/
class Tab extends CompositeField {
protected $tabSet;
public function __construct($name) {
$args = func_get_args();
$name = array_shift($args);
$this->id = preg_replace('/[^0-9A-Za-z]+/', '', $name);
$this->title = preg_replace('/([a-z0-9])([A-Z])/', '\\1 \\2', $name);
$this->name = $name;
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;
}
}
}
?>