本文整理汇总了PHP中ModelAdmin::getEditForm方法的典型用法代码示例。如果您正苦于以下问题:PHP ModelAdmin::getEditForm方法的具体用法?PHP ModelAdmin::getEditForm怎么用?PHP ModelAdmin::getEditForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelAdmin
的用法示例。
在下文中一共展示了ModelAdmin::getEditForm方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEditForm
/**
* Add GridFieldOrderableRows component to grid field keyed on ArtisanHasSortOrderExtension.FieldName (ArtisanSort).
*
* @param int|null $id
* @param FieldList|null $fields
* @return Form
*/
public function getEditForm($id = null, $fields = null)
{
$form = parent::getEditForm($id, $fields);
$gridField = $form->Fields()->fieldByName($this->sanitiseClassName($this->modelClass));
$gridField->getConfig()->addComponent(new GridFieldOrderableRows(ArtisanHasSortOrderExtension::FieldName));
return $form;
}
示例2: getEditForm
public function getEditForm($id = null, $fields = null)
{
$form = parent::getEditForm($id, $fields);
$grid = $form->Fields()->dataFieldByName($this->sanitiseClassName($this->modelClass));
$grid->getConfig()->removeComponentsByType('GridFieldAddNewButton');
return $form;
}
示例3: getEditForm
/**
*
* @param SS_Request $request
* @return Form
*/
public function getEditForm($id = null, $fields = null)
{
$form = parent::getEditForm($id, $fields);
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
// return $form;
}
if (!Permission::check('ADMIN')) {
return $form;
}
$fields = $form->Fields();
$config = $this->searchService->localEngineConfig();
$allow = $config ? $config->RunLocal : null;
$fields->push(new CheckboxField('RunLocal', _t('SolrAdmin.RUN_LOCAL', 'Run local Jetty instance of Solr?'), $allow));
if ($allow) {
$status = $this->searchService->localEngineStatus();
if (!$status) {
$fields->push(new CheckboxField('Start', _t('SolrAdmin.START', 'Start Solr')));
} else {
$fields->push(new CheckboxField('Kill', _t('SolrAdmin.Kill', 'Kill Solr process (' . $status . ')')));
}
$log = $this->searchService->getLogData(100);
$log = array_reverse($log);
$fields->push($logtxt = new TextareaField('Log', _t('SolrAdmin.LOG', 'Log')));
$logtxt->setColumns(20)->setRows(15)->setValue(implode($log));
}
$form->Actions()->push(new FormAction('saveconfig', _t('SolrAdmin.SAVE', 'Save')));
$form->Actions()->push(new FormAction('reindex', _t('SolrAdmin.REINDEX', 'Reindex')));
// $actions = new FieldSet();
// $form = new Form($this, 'EditForm', $fields, $actions);
return $form;
}
示例4: getEditForm
public function getEditForm($id = null, $fields = null)
{
$form = parent::getEditForm($id, $fields);
if ($this->modelClass == 'Order') {
$fields = $form->Fields();
$gridField = $fields->fieldByName('Order');
// Bulk manager
$manager = new GridFieldBulkManager();
$manager->removeBulkAction("bulkEdit");
$manager->removeBulkAction("unLink");
$manager->removeBulkAction("delete");
$manager->addBulkAction('paid', 'Mark Paid', 'CommerceGridFieldBulkAction_Paid');
$manager->addBulkAction('processing', 'Mark Processing', 'CommerceGridFieldBulkAction_Processing');
$manager->addBulkAction('dispatched', 'Mark Dispatched', 'CommerceGridFieldBulkAction_Dispatched');
// Add dispatch button
$field_config = $gridField->getConfig();
$field_config->addComponent($manager);
// Update list of items for subsite (if used)
if (class_exists('Subsite')) {
$list = $gridField->getList()->filter(array('SubsiteID' => Subsite::currentSubsiteID()));
$gridField->setList($list);
}
}
$this->extend("updateEditForm", $form);
return $form;
}
示例5: getEditForm
/**
* adjust the gridfield: remove all options to change content
*
* @param int $id
* @param FieldList $fields
* @return CMSForm
*/
public function getEditForm($id = null, $fields = null)
{
$form = parent::getEditForm($id, $fields);
// remove all the edit options
$field = $form->Fields()->fieldByName('ComposerSecurityVulnerability');
if ($field) {
$field->setConfig(new GridFieldConfig_Base());
}
if ($field) {
$field->getConfig()->addComponent(new GridFieldExternalLink());
}
// allow scheduled runs of the composer security vulnerability check if this is a admin and queuedjobs installed
if ($field) {
$this->addSimpleScheduleForm($form, 'ComposerSecurityVulnerability');
}
// add the available composer updates, if this package is installed
$field = $form->Fields()->fieldByName('ComposerUpdate');
if ($field) {
$field->setConfig(new GridFieldConfig_Base());
}
// allow scheduled runs of the composer security vulnerability check if this is a admin and queuedjobs installed
if ($field) {
$this->addSimpleScheduleForm($form, 'ComposerUpdate');
}
return $form;
}
开发者ID:helpfulrobot,项目名称:friendsofsilverstripe-silverstripe-maintenance,代码行数:33,代码来源:MaintenanceAdmin.php
示例6: getEditForm
public function getEditForm($id = null, $fields = null)
{
$form = parent::getEditForm($id, $fields);
$gridField = $form->Fields()->fieldByName($this->sanitiseClassName($this->modelClass));
$gridField->getConfig()->addComponents(new GridFieldAddExistingAutocompleter('buttons-before-left'), $filter = new GridFieldFilterHeader(), new GridFieldEditButton(), new GridFieldDeleteAction(true), new GridFieldDetailForm(), new GridFieldSortableRows('Order'));
return $form;
}
示例7: getEditForm
/**
* Form used for displaying the gridfield in the model admin
* @param {string} $id ID of the form
* @param {FieldList} $fields Fields to use in the form
* @return {Form} Form to be used in the model admin interface
*/
public function getEditForm($id = null, $fields = null)
{
$form = parent::getEditForm($id, $fields);
Requirements::css(KAPOST_DIR . '/css/KapostAdmin.css');
Requirements::javascript(KAPOST_DIR . '/javascript/KapostAdmin.js');
if ($this->modelClass == 'KapostObject' && ($gridField = $form->Fields()->dataFieldByName('KapostObject'))) {
$gridField->setList($gridField->getList()->filter('IsKapostPreview', 0));
$gridField->getConfig()->addComponent(new KapostGridFieldRefreshButton('before'))->removeComponentsByType('GridFieldAddNewButton')->getComponentByType('GridFieldDataColumns')->setFieldCasting(array('Created' => 'SS_Datetime->FormatFromSettings', 'KapostChangeType' => 'KapostFieldCaster->NiceChangeType', 'ToPublish' => 'KapostFieldCaster->NiceToPublish'));
$gridField->getConfig()->getComponentByType('GridFieldDetailForm')->setItemRequestClass('KapostGridFieldDetailForm_ItemRequest');
} else {
if ($this->modelClass == 'KapostConversionHistory' && ($gridField = $form->Fields()->dataFieldByName('KapostConversionHistory'))) {
$gridField->getConfig()->removeComponentsByType('GridFieldAddNewButton')->addComponent(new KapostDestinationAction(), 'GridFieldEditButton');
$dataColumns = $gridField->getConfig()->getComponentByType('GridFieldDataColumns');
$dataColumns->setFieldCasting(array('Created' => 'SS_Datetime->FormatFromSettings'));
$columns = $dataColumns->getDisplayFields($gridField);
$columns['DestinationTypeNice'] = _t('KapostConversionHistory.db_DestinationType', '_Destination Type');
$columns['KapostChangeTypeNice'] = _t('KapostConversionHistory.db_KapostChangeType', '_Change Type');
$columns = $dataColumns->setDisplayFields($columns);
$gridField->getConfig()->getComponentByType('GridFieldDetailForm')->setItemEditFormCallback(function (Form $form) {
$form->addExtraClass('KapostAdmin');
});
}
}
$form->addExtraClass('KapostAdmin');
return $form;
}
示例8: getEditForm
function getEditForm($id = null, $fields = null)
{
$form = parent::getEditForm($id, $fields);
Requirements::javascript('silverstripe-postmarked/javascript/PostmarkMessageButton.js');
if ($this->modelClass == Config::inst()->get('PostmarkAdmin', 'member_class')) {
$fields = $form->Fields();
$grid = $fields->dataFieldByName($this->sanitiseClassName($this->modelClass));
if ($grid) {
$configs = $grid->getConfig();
$configs->addComponent(new GridFieldPostmarkMessageButton());
$configs->addComponent(new GridFieldCustomerReadEmailsButton());
$configs->addComponent($tags = new GridFieldManageBulkRelationships('before'), 'GridFieldAddNewButton');
$tags->setFromClass($this->modelClass)->setRelationship('Tags')->setTitle(_t('CRMAdmin.Tags', 'Tags'));
$configs->addComponent($status = new GridFieldManageBulkRelationships('before'), 'GridFieldAddNewButton');
$status->setFromClass($this->modelClass)->setRelationship('Statuses')->setTitle(_t('CRMAdmin.Status', 'Status'));
$columns = $configs->getComponentByType('GridFieldDataColumns');
$arrColumns = array('getFullName' => _t('CRMAdmin.Name', 'Name'), 'Email' => _t('CRMAdmin.Email', 'Email'), 'Company' => _t('CRMAdmin.Company', 'Company'), 'getTagCollection' => _t('CRMAdmin.Tags', 'Tags'), 'getStatusCollection' => _t('CRMAdmin.Status', 'Status'), 'getUnreadMessages' => _t('CRMAdmin.UnreadMessages', 'Unread messages'));
$this->extend('updateCustomerGridColumns', $arrColumns);
$columns->setDisplayFields($arrColumns);
$configs->removeComponentsByType('GridFieldExportButton');
$configs->removeComponentsByType('GridFieldPrintButton');
$addButton = $configs->getComponentByType('GridFieldAddNewButton');
if ($addButton) {
$addButton->setButtonName(_t('CRMAdmin.AddCustomerButton', 'Add Customer'));
}
}
}
$this->extend('updateCRMEditorForm', $form, $this->modelClass);
return $form;
}
示例9: getEditForm
public function getEditForm($id = null, $fields = null)
{
$form = parent::getEditForm($id, $fields);
if ($this->modelClass == 'Staff' && ($gridField = $form->Fields()->dataFieldByName($this->sanitiseClassName($this->modelClass)))) {
}
return $form;
}
示例10: getEditForm
public function getEditForm($id = null, $fields = null)
{
$form = parent::getEditForm($id, $fields);
$gridField = $form->Fields()->fieldByName($this->sanitiseClassName($this->modelClass));
$gridField->getConfig()->getComponentByType('GridFieldExportButton')->setExportColumns(singleton($this->sanitiseClassName($this->modelClass))->getExportFields());
return $form;
}
示例11: getEditForm
public function getEditForm($id = null, $fields = null)
{
$form = parent::getEditForm($id, $fields);
$field = $form->Fields()->dataFieldByName($this->modelClass);
if ($field) {
$config = $field->getConfig();
if (!ClassInfo::exists('GridFieldBetterButtonsItemRequest') && $this->IsEditingNews()) {
$config->getComponentByType('GridFieldDetailForm')->setItemRequestClass('NewsGridFieldDetailForm_ItemRequest');
}
$singleton = singleton($this->modelClass);
if (is_a($singleton, 'NewsPost') && ClassInfo::exists('GridFieldOrderableRows')) {
$config->addComponent(new GridFieldOrderableRows('Sort'));
$exportButton = $config->getComponentByType('GridFieldExportButton');
if ($exportButton) {
$export = array('Title' => 'Title', 'DateTime' => 'DateTime', 'Author' => 'Author', 'ExportContent' => 'Content');
$this->extend('updateExportColumn', $export);
$exportButton->setExportColumns($export);
}
}
$config->removeComponentsByType('GridFieldDeleteAction');
$config->removeComponentsByType('GridFieldPaginator');
$config->addComponent($pagination = new GridFieldPaginator(100));
}
return $form;
}
示例12: getEditForm
public function getEditForm($id = null, $fields = null)
{
$form = parent::getEditForm($id, $fields);
$name = $this->sanitiseClassName($this->modelClass);
$grid = $form->Fields()->dataFieldByName($name);
$grid->getConfig()->getComponentByType('GridFieldDetailForm')->setItemRequestClass('AdvancedReportsAdminItemRequest');
return $form;
}
示例13: getEditForm
public function getEditForm($id = null, $fields = null)
{
$form = parent::getEditForm($id, $fields);
if ($grid = $form->Fields()->fieldByName('AdminHelp')) {
$grid->getConfig()->addComponent(GridFieldOrderableRows::create('Sort'));
}
return $form;
}
示例14: getEditForm
/**
*
* allows for custom CMSActions
*/
public function getEditForm($id = null, $fields = null)
{
$form = parent::getEditForm($id = null, $fields = null);
$listfield = $form->Fields()->fieldByName("DatabasebackupLog");
$model = Injector::inst()->get("DatabasebackupLog");
$listfield->getConfig()->getComponentByType('GridFieldDetailForm')->setItemRequestClass('DatabasebackupLogDetailForm_ItemRequest');
//->setFormActions($model->getCMSActions());
return $form;
}
示例15: getEditForm
public function getEditForm($id = null, $fields = null)
{
$form = parent::getEditForm($id, $fields);
$gridField = $form->Fields()->dataFieldByName('DNProject');
if ($gridField) {
$gridField->getConfig()->removeComponentsByType('GridFieldExportButton')->removeComponentsByType('GridFieldPrintButton')->removeComponentsByType('GridFieldAddNewButton')->addComponent(new GridFieldAddNewMultiClass('buttons-before-left'))->addComponent(new GridFieldExportButton('buttons-before-right'))->addComponent(new GridFieldPrintButton('buttons-before-right'));
}
return $form;
}