本文整理匯總了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();
}