本文整理汇总了PHP中Region::getCMSFields方法的典型用法代码示例。如果您正苦于以下问题:PHP Region::getCMSFields方法的具体用法?PHP Region::getCMSFields怎么用?PHP Region::getCMSFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Region
的用法示例。
在下文中一共展示了Region::getCMSFields方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testgetCMSFields
/**
@test
**/
public function testgetCMSFields()
{
$region = new Region();
$fields = $region->getCMSFields();
//Fiels array should not be empty
$this->assertNotEmpty($fields);
//Check total field
$this->assertEquals(3, count($fields));
$this->assertCount(3, $fields);
// Check basic field exists
$this->assertNotEmpty($fields->dataFieldByName('Description'));
$this->assertNotEmpty($fields->dataFieldByName('Title'));
$this->assertNotEmpty($fields->dataFieldByName('Photo'));
}
示例2: getCMSFields
/**
* Fields for CRUD of shipping regions
*
* @see DataObject::getCMSFields()
*/
public function getCMSFields()
{
// $fields = new FieldList(
// $rootTab = new TabSet('Root',
// $tabMain = new Tab('Region',
// TextField::create('Code', _t('Region.CODE', 'Code')),
// TextField::create('Title', _t('Region.TITLE', 'Title')),
// DropdownField::create('CountryID', 'Country', Country_Shipping::get()->map()->toArray())
// )
// )
// );
// return $fields;
$fields = parent::getCMSFields();
$fields->replaceField('CountryID', DropdownField::create('CountryID', 'Country', Country_Shipping::get()->map()->toArray()));
$fields->removeByName('SortOrder');
$fields->removeByName('ShopConfigID');
return $fields;
}
示例3: getCMSFields
/**
* Fields for CRUD of shipping regions
*
* @see DataObject::getCMSFields()
*/
function getCMSFields()
{
$fields = parent::getCMSFields();
$countryField = new DropdownField('CountryID', 'Country', Country::shipping_countries());
$fields->replaceField('CountryID', $countryField);
return $fields;
}