本文整理汇总了PHP中CMSForm::Fields方法的典型用法代码示例。如果您正苦于以下问题:PHP CMSForm::Fields方法的具体用法?PHP CMSForm::Fields怎么用?PHP CMSForm::Fields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMSForm
的用法示例。
在下文中一共展示了CMSForm::Fields方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateEditForm
public function updateEditForm(CMSForm &$form)
{
$fields = $form->Fields();
$class = $this->owner->modelClass;
$o = singleton($class);
$gf = $form->Fields()->dataFieldByName($class);
$config = $gf->getConfig();
// If we have the bulk manager, enable by default
if (class_exists('GridFieldBulkManager')) {
if ($o->hasMethod('bulkManagerDisable') && $o->bulkManagerDisable) {
} else {
$config->addComponent($bulkManager = new GridFieldBulkManager());
if ($o->hasMethod('bulkManagerAdd')) {
$actions = $o->bulkManagerAdd();
foreach ($actions as $key => $action) {
$bulkHandler = isset($action['Handler']) ? $action['Handler'] : null;
$bulkConfig = isset($action['Config']) ? $action['Config'] : null;
$bulkManager->addBulkAction($action['Name'], $action['Label'], $bulkHandler, $bulkConfig);
}
}
}
}
// If we have the export all button (form-extras module), enable
if (class_exists('GridFieldExportAllButton')) {
$config->addComponent(new GridFieldExportAllButton('before'));
}
if (!Director::isDev() || !Permission::check('ADMIN')) {
return;
}
// Add buttons
$config->addComponent(new GridFieldButtonRow('after'));
$config->addComponent($btnEmpty = new DevToolkitEmptyButton('buttons-after-left'));
if ($o->hasMethod('provideFake')) {
$config->addComponent($btnAddFake = new DevToolkitAddFakeButton('buttons-after-left'));
}
if ($o->hasExtension('GeoExtension')) {
$config->addComponent($btnAddFake = new DevToolkitFakeLocationsButton('buttons-after-left'));
}
$config->addComponent($btnDump = new DevToolkitDumpButton('buttons-after-left'));
// Show session message
$message = self::SessionMessage();
if ($message) {
$fields->insertBefore(new LiteralField("dev_message", "<div class='message {$message->Type}'>{$message->Content}</div>"), $gf->getName());
}
}