本文整理汇总了PHP中ModelAdmin::EditForm方法的典型用法代码示例。如果您正苦于以下问题:PHP ModelAdmin::EditForm方法的具体用法?PHP ModelAdmin::EditForm怎么用?PHP ModelAdmin::EditForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelAdmin
的用法示例。
在下文中一共展示了ModelAdmin::EditForm方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: EditForm
/**
* Add GridFieldOrderableRows to the GridField
* @param null $request
* @return \Form
*/
public function EditForm($request = null)
{
$form = parent::EditForm($request);
$fields = $form->Fields();
/** @var \GridField $gridField */
if ($gridField = $fields->dataFieldByName('Modular-Models-GridListFilters')) {
if ($config = $gridField->getConfig()) {
$config->addComponent(new GridFieldOrderableRows('Sort'));
}
}
return $form;
}
示例2: EditForm
public function EditForm($request = null, $vars = null)
{
$form = parent::EditForm();
$grid = $form->Fields()->dataFieldByName('ContentChangeset');
$config = $grid->getConfig();
$config->removeComponentsByType('GridFieldDeleteAction');
$config->removeComponentsByType('GridFieldFilterHeader');
$config->removeComponentsByType('GridFieldAddNewButton');
$config->removeComponentsByType('GridFieldExportButton');
$config->removeComponentsByType('GridFieldPrintButton');
// $grid->setList($this->changesetService->getAvailableChangesets());
$config->getComponentByType('GridFieldDetailForm')->setItemEditFormCallback(function ($form, $itemRequest) {
$actions = new FieldList();
$record = $form->getRecord();
if ($record->Status == 'Active') {
$actions->push(FormAction::create('submitall', 'Submit all')->setUseButtonTag(true)->addExtraClass('ss-ui-action-constructive'));
$actions->push(FormAction::create('revertall', 'Revert all')->setUseButtonTag(true)->addExtraClass('ss-ui-action-destructive'));
$curmbs = $itemRequest->Breadcrumbs();
if ($curmbs && $curmbs->count() >= 2) {
$one_level_up = $curmbs->offsetGet($curmbs->count() - 2);
$text = sprintf("<a class=\"%s\" href=\"%s\">%s</a>", "crumb ss-ui-button ss-ui-action-destructive cms-panel-link ui-corner-all", $one_level_up->Link, _t('GridFieldDetailForm.CancelBtn', 'Cancel'));
$actions->push(new LiteralField('cancelbutton', $text));
}
$record->updateCMSActions($actions);
} else {
if ($record->Status == 'Published') {
$nodes = DataList::create('RemoteSyncroNode')->map();
if ($nodes->count()) {
$form->Fields()->insertBefore(new DropdownField('TargetNode', 'Deploy to', $nodes), 'ChangesetItems');
$actions->push(FormAction::create('push', 'Deploy changes')->setUseButtonTag(true)->addExtraClass('ss-ui-action-constructive'));
} else {
$form->Fields()->insertBefore(LiteralField::create('DeployNotice', '<strong>Create a Syncro node to deploy this changeset</strong>'), 'ChangesetItems');
}
}
}
$form->setActions($actions);
});
$config->getComponentByType('GridFieldDetailForm')->setItemRequestClass('ChangesetDetail_ItemRequest');
return $form;
}
示例3: EditForm
public function EditForm($request = null)
{
$form = parent::EditForm($request);
Requirements::javascript(FLICKR_EDIT_TOOLS_PATH . '/javascript/flickredit.js');
Requirements::css(FLICKR_EDIT_TOOLS_PATH . '/css/flickredit.css');
$flickrSetPages = DataList::create('FlickrSetPage')->where('ParentID = 0');
//->sort('Title desc');
$flickrSetFolders = DataList::create('FlickrSetFolder')->sort('Title');
$html = '<h2>Flickr Set Folders</h2><div id="flickrFolders">';
foreach ($flickrSetFolders as $key => $folder) {
$html .= '<div class="flickrSetFolderDroppable" data-id="' . $folder->ID . '">' . $folder->Title . '</div>';
}
$html .= '</div><h2>Flickr Set Pages</h2><div id="flickrSetPages">';
foreach ($flickrSetPages as $key => $fspage) {
$html .= '<div class="flickrSetDraggable" data-id="' . $fspage->ID . '">' . $fspage->Title . '</div>';
}
$html .= '</div>';
$lf = new LiteralField('FlickrSetOrganizer', $html);
//$form->Fields()->push($lf);
$fl = new FieldList();
$fl->push($lf);
$form->setFields($fl);
return $form;
}