本文整理汇总了PHP中Tab::fieldByName方法的典型用法代码示例。如果您正苦于以下问题:PHP Tab::fieldByName方法的具体用法?PHP Tab::fieldByName怎么用?PHP Tab::fieldByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tab
的用法示例。
在下文中一共展示了Tab::fieldByName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testNestedTabsFindingFieldByName
/**
* Test finding a field that's inside a tabset, within another tab.
*/
function testNestedTabsFindingFieldByName()
{
$fields = new FieldSet();
/* 2 tabs get created within a TabSet inside our set */
$tab = new TabSet('Root', new TabSet('Content', $mainTab = new Tab('Main'), $otherTab = new Tab('Others')));
$fields->push($tab);
/* Some fields get added to the 2 tabs we just created */
$fields->addFieldToTab('Root.Content.Main', new TextField('Country'));
$fields->addFieldToTab('Root.Content.Others', new TextField('Email'));
/* The fields we just added actually exists in the set */
$this->assertNotNull($fields->dataFieldByName('Country'));
$this->assertNotNull($fields->dataFieldByName('Email'));
/* The fields we just added actually exist in the tabs */
$this->assertNotNull($mainTab->fieldByName('Country'));
$this->assertNotNull($otherTab->fieldByName('Email'));
/* We have 1 field for each of the tabs */
$this->assertEquals(1, $mainTab->Fields()->Count());
$this->assertEquals(1, $otherTab->Fields()->Count());
$this->assertNotNull($fields->fieldByName('Root.Content'));
$this->assertNotNull($fields->fieldByName('Root.Content.Main'));
}
示例2: fieldByName
/**
* @inheritdoc
*/
public function fieldByName($name)
{
return $this->tab->fieldByName();
}