当前位置: 首页>>代码示例>>PHP>>正文


PHP ModelAdmin::EditForm方法代码示例

本文整理汇总了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;
 }
开发者ID:CrackerjackDigital,项目名称:silverstripe-modular,代码行数:17,代码来源:GridListFilters.php

示例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;
 }
开发者ID:helpfulrobot,项目名称:silverstripe-australia-changesets,代码行数:40,代码来源:ChangesetsAdmin.php

示例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;
 }
开发者ID:gordonbanderson,项目名称:flickr-editor,代码行数:24,代码来源:FlickrSetPageFolderAdmin.php


注:本文中的ModelAdmin::EditForm方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。