silverstripe-framework/forms/Tab.php
Sean Harvey ef1033111a BUGFIX Tab->fieldByName() was checking the property "Name" on the child elements, when it's actually a method call instead
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@56179 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-06-13 01:56:29 +00:00

50 lines
811 B
PHP
Executable File

<?php
/**
* @package forms
* @subpackage fields-structural
*/
/**
* Implements a single tab in a {@link TabSet}.
* @package forms
* @subpackage fields-structural
*/
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;
}
}
}
?>