本文整理汇总了PHP中ListboxField::Create方法的典型用法代码示例。如果您正苦于以下问题:PHP ListboxField::Create方法的具体用法?PHP ListboxField::Create怎么用?PHP ListboxField::Create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListboxField
的用法示例。
在下文中一共展示了ListboxField::Create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCMSFields
function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Main', new TextField('Description', 'Story Summary'), 'Content');
$fields->addFieldToTab('Root.Main', new UploadField('CoverImage', 'Cover Image'), 'Content');
$fields->addFieldToTab('Root.Main', new DropdownField('Rating', 'Story Rating', $this->dbObject('Rating')->enumValues()), 'Content');
$fields->addFieldToTab('Root.Main', new DropdownField('StoryStatus', 'Story Status', $this->dbObject('StoryStatus')->enumValues()), 'Content');
$fields->addFieldToTab('Root.Main', new DropdownField('Type', 'Story Type', $this->dbObject('Type')->enumValues()), 'Content');
$fields->addFieldToTab('Root.Main', $dateField = new DateField('Added', 'Added on (for example: 12/20/2010)'), 'Content');
$dateField->setConfig('showcalendar', true);
$dateField->setConfig('dateformat', 'MM/dd/YYYY');
$characters = DataObject::get('Character');
if (!empty($characters)) {
// create an array('ID'=>'Name')
$characterMap = $characters->map("ID", "Name", "Please Select");
// create a Multi-select group based on the array
$fields->addFieldToTab('Root.Details', ListboxField::Create('Characters', 'Select a Character')->setMultiple(true)->setSource($characterMap));
}
$series = DataObject::get('Series');
if (!empty($series)) {
// create an array('ID'=>'Name')
$seriesMap = $series->map("ID", "Name", "Please Select");
// create a Multi-select group based on the array
$fields->addFieldToTab('Root.Details', ListboxField::Create('Series', 'Select a Series')->setMultiple(true)->setSource($seriesMap));
}
$genres = DataObject::get('Genre');
if (!empty($genres)) {
// create an array('ID'=>'Name')
$genreMap = $genres->map("ID", "Name", "Please Select");
// create a Multi-select group based on the array
$fields->addFieldToTab('Root.Details', ListboxField::Create('Genres', 'Select a Genre')->setMultiple(true)->setSource($genreMap));
}
$authors = DataObject::get('Author');
if (!empty($authors)) {
// create an array('ID'=>'Name')
$authorMap = $authors->map("ID", "Name", "Please Select");
// create a Multi-select group based on the array
$fields->addFieldToTab('Root.Details', ListboxField::create('Authors', 'Select an Author')->setMultiple(true)->setSource($authorMap));
}
return $fields;
}
示例2: getCMSFields
function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Main', new TextField('Description', 'Article Summary'), 'Content');
$fields->addFieldToTab('Root.Main', new UploadField('CoverImage', 'Cover Image'), 'Content');
$categories = DataObject::get('ArticleCategory');
if (!empty($categories)) {
// create an array('ID'=>'Name')
$categoriesMap = $categories->map("ID", "Name", "Please Select");
// create a Multi-select group based on the array
$fields->addFieldToTab('Root.Details', ListboxField::Create('ArticleCategories', 'Select a Category')->setMultiple(true)->setSource($categoriesMap));
}
$authors = DataObject::get('Author');
if (!empty($authors)) {
// create an array('ID'=>'Name')
$authorsMap = $authors->map("ID", "Name", "Please Select");
// create a Multi-select group based on the array
$fields->addFieldToTab('Root.Details', ListboxField::Create('Authors', 'Select an Author')->setMultiple(true)->setSource($authorsMap));
}
return $fields;
}