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


PHP Form::setTemplate方法代码示例

本文整理汇总了PHP中Form::setTemplate方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::setTemplate方法的具体用法?PHP Form::setTemplate怎么用?PHP Form::setTemplate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Form的用法示例。


在下文中一共展示了Form::setTemplate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getEditForm

 /**
  * @return Form
  */
 public function getEditForm($id = null, $fields = null)
 {
     if (!$id) {
         $id = $this->currentPageID();
     }
     $form = parent::getEditForm($id);
     $record = $this->getRecord($id);
     if ($record && !$record->canView()) {
         return Security::permissionFailure($this);
     }
     $newComments = Comment::get()->filter('Moderated', 0);
     $newGrid = new CommentsGridField('NewComments', _t('CommentsAdmin.NewComments', 'New'), $newComments, CommentsGridFieldConfig::create());
     $approvedComments = Comment::get()->filter('Moderated', 1)->filter('IsSpam', 0);
     $approvedGrid = new CommentsGridField('ApprovedComments', _t('CommentsAdmin.ApprovedComments', 'Approved'), $approvedComments, CommentsGridFieldConfig::create());
     $spamComments = Comment::get()->filter('Moderated', 1)->filter('IsSpam', 1);
     $spamGrid = new CommentsGridField('SpamComments', _t('CommentsAdmin.SpamComments', 'Spam'), $spamComments, CommentsGridFieldConfig::create());
     $newCount = '(' . count($newComments) . ')';
     $approvedCount = '(' . count($approvedComments) . ')';
     $spamCount = '(' . count($spamComments) . ')';
     $fields = new FieldList($root = new TabSet('Root', new Tab('NewComments', _t('CommentAdmin.NewComments', 'New') . ' ' . $newCount, $newGrid), new Tab('ApprovedComments', _t('CommentAdmin.ApprovedComments', 'Approved') . ' ' . $approvedCount, $approvedGrid), new Tab('SpamComments', _t('CommentAdmin.SpamComments', 'Spam') . ' ' . $spamCount, $spamGrid)));
     $root->setTemplate('CMSTabSet');
     $actions = new FieldList();
     $form = new Form($this, 'EditForm', $fields, $actions);
     $form->addExtraClass('cms-edit-form');
     $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
     if ($form->Fields()->hasTabset()) {
         $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
         $form->addExtraClass('center ss-tabset cms-tabset ' . $this->BaseCSSClasses());
     }
     $this->extend('updateEditForm', $form);
     return $form;
 }
开发者ID:krissihall,项目名称:sm_ss,代码行数:35,代码来源:CommentAdmin.php

示例2: getEditForm

 /**
  * @return Form
  */
 function getEditForm($id = null, $fields = null)
 {
     $siteConfig = SiteConfig::current_site_config();
     $fields = $siteConfig->getCMSFields();
     $actions = $siteConfig->getCMSActions();
     $form = new Form($this, 'EditForm', $fields, $actions);
     $form->addExtraClass('root-form');
     $form->addExtraClass('cms-edit-form cms-panel-padded center');
     // don't add data-pjax-fragment=CurrentForm, its added in the content template instead
     if ($form->Fields()->hasTabset()) {
         $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
     }
     $form->setHTMLID('Form_EditForm');
     $form->loadDataFrom($siteConfig);
     $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
     // Use <button> to allow full jQuery UI styling
     $actions = $actions->dataFields();
     if ($actions) {
         foreach ($actions as $action) {
             $action->setUseButtonTag(true);
         }
     }
     $this->extend('updateEditForm', $form);
     return $form;
 }
开发者ID:prostart,项目名称:cobblestonepath,代码行数:28,代码来源:CMSSettingsController.php

示例3: getEditForm

 /**
  * @return Form
  */
 public function getEditForm($id = null, $fields = null)
 {
     if (!$id) {
         $id = $this->currentPageID();
     }
     $form = parent::getEditForm($id);
     $record = $this->getRecord($id);
     if ($record && !$record->canView()) {
         return Security::permissionFailure($this);
     }
     $commentsConfig = GridFieldConfig::create()->addComponents(new GridFieldFilterHeader(), new GridFieldDataColumns(), new GridFieldSortableHeader(), new GridFieldPaginator(25), new GridFieldDeleteAction(), new GridFieldDetailForm(), new GridFieldExportButton(), new GridFieldEditButton(), new GridFieldDetailForm());
     $needs = new GridField('Comments', _t('CommentsAdmin.NeedsModeration', 'Needs Moderation'), Comment::get()->where('Moderated = 0'), $commentsConfig);
     $moderated = new GridField('CommentsModerated', _t('CommentsAdmin.CommentsModerated'), Comment::get()->where('Moderated = 1'), $commentsConfig);
     $fields = new FieldList($root = new TabSet('Root', new Tab('NeedsModeration', _t('CommentAdmin.NeedsModeration', 'Needs Moderation'), $needs), new Tab('Comments', _t('CommentAdmin.Moderated', 'Moderated'), $moderated)));
     $root->setTemplate('CMSTabSet');
     $actions = new FieldList();
     $form = new Form($this, 'EditForm', $fields, $actions);
     $form->addExtraClass('cms-edit-form');
     $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
     if ($form->Fields()->hasTabset()) {
         $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
         $form->addExtraClass('center ss-tabset cms-tabset ' . $this->BaseCSSClasses());
     }
     $this->extend('updateEditForm', $form);
     return $form;
 }
开发者ID:roed,项目名称:silverstripe-comments,代码行数:29,代码来源:CommentAdmin.php

示例4: AddForm

 /**
  * @return Form
  */
 public function AddForm()
 {
     $record = $this->currentPage();
     $moduleTypes = array();
     foreach ($this->ModuleTypes() as $type) {
         $html = sprintf('<span class="page-icon class-%s"></span><strong class="title">%s</strong><span class="description">%s</span>', $type->getField('Title'), $type->getField('AddAction'), $type->getField('Description'));
         $moduleTypes[$type->getField('ClassName')] = $html;
     }
     // Ensure generic page type shows on top
     if (isset($moduleTypes['Page'])) {
         $pageTitle = $moduleTypes['Page'];
         $moduleTypes = array_merge(array('Page' => $pageTitle), $moduleTypes);
     }
     $numericLabelTmpl = '<span class="step-label"><span class="flyout">%d</span><span class="arrow"></span><span class="title">%s</span></span>';
     $topTitle = _t('CMSPageAddController.ParentMode_top', 'Top level');
     $childTitle = _t('CMSPageAddController.ParentMode_child', 'Under another page');
     $fields = new FieldList($typeField = new OptionsetField("ModuleType", sprintf($numericLabelTmpl, 1, _t('ContentModuleMain.ChooseModuleType', 'Choose module type')), $moduleTypes));
     $actions = new FieldList(FormAction::create("doAdd", _t('CMSMain.Create', "Create"))->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept')->setUseButtonTag(true));
     $this->extend('updateModuleOptions', $fields);
     $form = new Form($this, "AddForm", $fields, $actions);
     $form->addExtraClass('cms-add-form stacked cms-content center cms-edit-form ' . $this->BaseCSSClasses());
     $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
     if ($parentID = $this->request->getVar('ParentID')) {
         $form->Fields()->dataFieldByName('ParentID')->setValue((int) $parentID);
     }
     return $form;
 }
开发者ID:webtorque7,项目名称:inpage-modules,代码行数:30,代码来源:ContentModuleAddController.php

示例5: AddForm

 /**
  * @return Form
  */
 public function AddForm()
 {
     $fields = new FieldList(new LiteralField('SelectFieldType', '<p><strong>Please select a field type to add:</strong></p>'), $df = new DropdownField('ClassName', '', $this->getFieldTypes(), null, null));
     $df->setHasEmptyDefault(true);
     if ($schemaID = (int) $this->request->param('ID')) {
         $fields->push(new HiddenField('SchemaID', '', $schemaID));
     }
     $actions = new FieldList(FormAction::create('doAddField', 'Create')->setUseButtonTag(true)->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept'));
     // Add a Cancel link which is a button-like link and link back to one level up.
     $curmbs = $this->Breadcrumbs();
     if ($curmbs && $curmbs->count() >= 2) {
         $one_level_up = $curmbs->offsetGet($curmbs->count() - 2);
         $text = "\n\t\t\t<a class=\"crumb ss-ui-button ss-ui-action-destructive cms-panel-link ui-corner-all\" href=\"" . $one_level_up->Link . "\">\n\t\t\t\tCancel\n\t\t\t</a>";
         $actions->push(new LiteralField('cancelbutton', $text));
     }
     $form = new Form($this, 'AddForm', $fields, $actions);
     $toplevelController = $this->getToplevelController();
     $form->setTemplate('LeftAndMain_EditForm');
     $form->addExtraClass('cms-content cms-edit-form center ss-tabset stacked');
     $form->setAttribute('data-pjax-fragment', 'CurrentForm Content');
     if ($form->Fields()->hasTabset()) {
         $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
     }
     //var_dump($this->popupController); die;
     $parents = $this->popupController->Breadcrumbs(false)->items;
     $form->Backlink = array_pop($parents)->Link;
     return $form;
 }
开发者ID:helpfulrobot,项目名称:silverstripe-australia-metadata,代码行数:31,代码来源:MetaDataFieldAddForm.php

示例6: getEditForm

 public function getEditForm($id = null, $fields = null)
 {
     $classname = $this->modelClass;
     $list = $classname::get();
     $listField = GridField::create($this->sanitiseClassName($this->modelClass), false, $list, $fieldConfig = GridFieldConfig_RecordEditor::create($this->stat('page_length'))->removeComponentsByType('GridFieldFilterHeader'));
     if (!$this->stat('enable_sorting')) {
         $summary_fields = Config::inst()->get($this->modelClass, 'summary_fields');
         $sorting = array();
         foreach ($summary_fields as $col) {
             $sorting[$col] = 'FieldNameNoSorting';
         }
         $fieldConfig->getComponentByType('GridFieldSortableHeader')->setFieldSorting($sorting);
     }
     // Validation
     if (singleton($this->modelClass)->hasMethod('getCMSValidator')) {
         $detailValidator = singleton($this->modelClass)->getCMSValidator();
         $listField->getConfig()->getComponentByType('GridFieldDetailForm')->setValidator($detailValidator);
     }
     $form = new Form($this, 'EditForm', new FieldList($listField), new FieldList());
     $form->addExtraClass('cms-edit-form cms-panel-padded center');
     $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
     $editFormAction = Controller::join_links($this->Link($this->sanitiseClassName($this->modelClass)), 'EditForm');
     $form->setFormAction($editFormAction);
     $form->setAttribute('data-pjax-fragment', 'CurrentForm');
     $this->extend('updateEditForm', $form);
     return $form;
 }
开发者ID:helpfulrobot,项目名称:axllent-silverstripe-simplemodeladmin,代码行数:27,代码来源:SimpleModelAdmin.php

示例7: getEditForm

 /**
  * @return Form
  * @todo what template is used here? AssetAdmin_UploadContent.ss doesn't seem to be used anymore
  */
 public function getEditForm($id = null, $fields = null)
 {
     Requirements::javascript(FRAMEWORK_DIR . '/javascript/AssetUploadField.js');
     Requirements::css(FRAMEWORK_DIR . '/css/AssetUploadField.css');
     $folder = $this->currentPage();
     $uploadField = UploadField::create('AssetUploadField', '');
     $uploadField->setConfig('previewMaxWidth', 40);
     $uploadField->setConfig('previewMaxHeight', 30);
     $uploadField->addExtraClass('ss-assetuploadfield');
     $uploadField->removeExtraClass('ss-uploadfield');
     $uploadField->setTemplate('AssetUploadField');
     if ($folder->exists() && $folder->getFilename()) {
         // The Upload class expects a folder relative *within* assets/
         $path = preg_replace('/^' . ASSETS_DIR . '\\//', '', $folder->getFilename());
         $uploadField->setFolderName($path);
     } else {
         $uploadField->setFolderName(ASSETS_DIR);
     }
     $exts = $uploadField->getValidator()->getAllowedExtensions();
     asort($exts);
     $form = new Form($this, 'getEditForm', new FieldList($uploadField, new LiteralField('AllowedExtensions', sprintf('<p>%s: %s</p>', _t('AssetAdmin.ALLOWEDEXTS', 'Allowed extensions'), implode('<em>, </em>', $exts))), new HiddenField('ID')), new FieldList());
     $form->addExtraClass('center cms-edit-form ' . $this->BaseCSSClasses());
     // Don't use AssetAdmin_EditForm, as it assumes a different panel structure
     $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
     $form->Fields()->push(new LiteralField('BackLink', sprintf('<a href="%s" class="backlink ss-ui-button cms-panel-link" data-icon="back">%s</a>', Controller::join_links(singleton('AssetAdmin')->Link('show'), $folder ? $folder->ID : 0), _t('AssetAdmin.BackToFolder', 'Back to folder'))));
     $form->loadDataFrom($folder);
     return $form;
 }
开发者ID:prostart,项目名称:cobblestonepath,代码行数:32,代码来源:CMSFileAddController.php

示例8: alterCommentForm

 public function alterCommentForm(Form $form)
 {
     $form->transform(new FoundationFormTransformation());
     $form->setTemplate('FoundationCommentingControllerForm', 'FoundationForm', 'Form');
     $form->addExtraClass('custom');
     if ($form->hasExtension('FormSpamProtectionExtension')) {
         $form->enableSpamProtection();
     }
 }
开发者ID:helpfulrobot,项目名称:rywa-silverstripe-foundation-forms,代码行数:9,代码来源:FoundationCommentingController.php

示例9: ItemEditForm

 /**
  * Builds an item edit form.  The arguments to getCMSFields() are the popupController and
  * popupFormName, however this is an experimental API and may change.
  * 
  * @todo In the future, we will probably need to come up with a tigher object representing a partially
  * complete controller with gaps for extra functionality.  This, for example, would be a better way
  * of letting Security/login put its log-in form inside a UI specified elsewhere.
  * 
  * @return Form 
  */
 function ItemEditForm()
 {
     if (empty($this->record)) {
         $controller = Controller::curr();
         $noActionURL = $controller->removeAction($_REQUEST['url']);
         $controller->getResponse()->removeHeader('Location');
         //clear the existing redirect
         return $controller->redirect($noActionURL, 302);
     }
     $actions = new FieldList();
     if ($this->record->ID !== 0) {
         $actions->push(FormAction::create('doSave', _t('GridFieldDetailForm.Save', 'Save'))->setUseButtonTag(true)->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept'));
         $actions->push(FormAction::create('doDelete', _t('GridFieldDetailForm.Delete', 'Delete'))->addExtraClass('ss-ui-action-destructive'));
     } else {
         // adding new record
         //Change the Save label to 'Create'
         $actions->push(FormAction::create('doSave', _t('GridFieldDetailForm.Create', 'Create'))->setUseButtonTag(true)->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'add'));
         // Add a Cancel link which is a button-like link and link back to one level up.
         $curmbs = $this->Breadcrumbs();
         if ($curmbs && $curmbs->count() >= 2) {
             $one_level_up = $curmbs->offsetGet($curmbs->count() - 2);
             $cancelText = _t('GridFieldDetailForm.CancelBtn', 'Cancel');
             $text = "\r\n\t\t\t\t<a class=\"crumb ss-ui-button ss-ui-action-destructive cms-panel-link ui-corner-all\" href=\"" . $one_level_up->Link . "\">\r\n\t\t\t\t\t{$cancelText}\r\n\t\t\t\t</a>";
             $actions->push(new LiteralField('cancelbutton', $text));
         }
     }
     $fk = $this->gridField->getList()->foreignKey;
     $this->record->{$fk} = $this->gridField->getList()->foreignID;
     $form = new Form($this, 'ItemEditForm', $this->record->getCMSFields(), $actions, $this->component->getValidator());
     $form->loadDataFrom($this->record);
     // TODO Coupling with CMS
     $toplevelController = $this->getToplevelController();
     if ($toplevelController && $toplevelController instanceof LeftAndMain) {
         // Always show with base template (full width, no other panels),
         // regardless of overloaded CMS controller templates.
         // TODO Allow customization, e.g. to display an edit form alongside a search form from the CMS controller
         $form->setTemplate('LeftAndMain_EditForm');
         $form->addExtraClass('cms-content cms-edit-form center ss-tabset');
         $form->setAttribute('data-pjax-fragment', 'CurrentForm Content');
         if ($form->Fields()->hasTabset()) {
             $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
         }
         if ($toplevelController->hasMethod('Backlink')) {
             $form->Backlink = $toplevelController->Backlink();
         } elseif ($this->popupController->hasMethod('Breadcrumbs')) {
             $parents = $this->popupController->Breadcrumbs(false)->items;
             $form->Backlink = array_pop($parents)->Link;
         } else {
             $form->Backlink = $toplevelController->Link();
         }
     }
     $cb = $this->component->getItemEditFormCallback();
     if ($cb) {
         $cb($form, $this);
     }
     return $form;
 }
开发者ID:vinstah,项目名称:body,代码行数:67,代码来源:GridFieldDetailForm.php

示例10: alterCommentForm

 public function alterCommentForm(Form $form)
 {
     $form->Fields()->bootstrapify();
     $form->Actions()->bootstrapify();
     $form->setTemplate('FoundationCommentingControllerForm', 'FoundationForm');
     if ($form->hasExtension('FormSpamProtectionExtension')) {
         $form->enableSpamProtection();
     }
     Requirements::css(FOUNDATIONFORMS_DIR . '/css/foundationforms.css');
 }
开发者ID:rywa,项目名称:silverstripe-foundation-forms,代码行数:10,代码来源:FoundationCommentingController.php

示例11: Form

 /**
  * This method should be overloaded to build out the detail form.
  *
  * @return Form
  */
 public function Form()
 {
     $form = new Form($this, 'Form', new FieldList($root = new TabSet('Root', new Tab('Main'))), new FieldList());
     if ($this->getTopLevelController() instanceof LeftAndMain) {
         $form->setTemplate('LeftAndMain_EditForm');
         $form->addExtraClass('cms-content cms-edit-form cms-tabset center');
         $form->setAttribute('data-pjax-fragment', 'CurrentForm Content');
         $root->setTemplate('CMSTabSet');
         $form->Backlink = $this->getBackLink();
     }
     return $form;
 }
开发者ID:helpfulrobot,项目名称:ajshort-silverstripe-gridfieldextensions,代码行数:17,代码来源:GridFieldRequestHandler.php

示例12: getEditForm

 /**
  * @param int|null $id
  * @param array|null $fields
  * @return \Form
  */
 public function getEditForm($id = null, $fields = null)
 {
     $queues = $this->getQueues();
     $gridField = new GridField('Queues', 'Queues', $queues, new GridFieldConfig_RecordEditor());
     $dataComponent = $gridField->getConfig()->getComponentByType('GridFieldDataColumns');
     $dataComponent->setDisplayFields(array('Name' => 'Name', 'Size' => 'Size'));
     $form = new Form($this, 'EditForm', new FieldList($gridField), new FieldList());
     $form->addExtraClass('cms-edit-form cms-panel-padded center');
     $form->setAttribute('data-pjax-fragment', 'CurrentForm');
     $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
     $form->setAttribute('data-pjax-fragment', 'CurrentForm');
     return $form;
 }
开发者ID:helpfulrobot,项目名称:silverstripe-deploynaut,代码行数:18,代码来源:ResqueReport.php

示例13: BlogSearchForm

 /**
  * Get search form
  *
  * @return Form
  */
 public function BlogSearchForm()
 {
     $searchField = TextField::create('Keyword', false)->setAttribute('placeholder', 'Type to search')->setAttribute('type', 'search');
     $keyword = Controller::curr()->request->getVar('Search');
     if ($keyword) {
         $searchField->setValue($keyword);
     }
     $fields = new FieldList($searchField);
     $formAction = FormAction::create('doSearch');
     $formAction->useButtonTag = true;
     $formAction->setButtonContent('<span class="fa fa-search"></span>');
     $actions = new FieldList($formAction);
     $form = new Form($this, 'BlogSearchForm', $fields, $actions);
     $form->setAttribute('role', 'search');
     $form->setTemplate('BlogSearchForm');
     return $form;
 }
开发者ID:sentromedia,项目名称:letsfund,代码行数:22,代码来源:BlogSearchWidget.php

示例14: updateProfileForm

 public function updateProfileForm(Form $form)
 {
     if (!Config::inst()->get('BootstrapForm', 'bootstrap_included')) {
         Requirements::css(BOOTSTRAP_FORMS_DIR . '/css/bootstrap.css');
     }
     if (!Config::inst()->get('BootstrapForm', 'jquery_included')) {
         Requirements::javascript(THIRDPARTY_DIR . "/jquery/jquery.js");
     }
     if (!Config::inst()->get('BootstrapForm', 'bootstrap_form_included')) {
         Requirements::javascript(BOOTSTRAP_FORMS_DIR . "/javascript/bootstrap_forms.js");
     }
     $form->Fields()->bootstrapify();
     $form->Actions()->bootstrapify();
     $form->addExtraClass('well');
     $form->addExtraClass('form-horizontal');
     $form->setTemplate('BootstrapForm');
 }
开发者ID:helpfulrobot,项目名称:hpmewes-silverstripe-install,代码行数:17,代码来源:BootstrapMemberProfileForm.php

示例15: getEditForm

 public function getEditForm($id = null, $fields = null)
 {
     // TODO Duplicate record fetching (see parent implementation)
     if (!$id) {
         $id = $this->currentPageID();
     }
     $form = parent::getEditForm($id);
     // TODO Duplicate record fetching (see parent implementation)
     $record = $this->getRecord($id);
     if ($record && !$record->canView()) {
         return Security::permissionFailure($this);
     }
     $memberList = GridField::create('Members', false, Member::get(), $memberListConfig = GridFieldConfig_RecordEditor::create()->addComponent(new GridFieldExportButton()))->addExtraClass("members_grid");
     $memberListConfig->getComponentByType('GridFieldDetailForm')->setValidator(new Member_Validator());
     $groupList = GridField::create('Groups', false, Group::get(), GridFieldConfig_RecordEditor::create());
     $columns = $groupList->getConfig()->getComponentByType('GridFieldDataColumns');
     $columns->setDisplayFields(array('Breadcrumbs' => singleton('Group')->fieldLabel('Title')));
     $fields = new FieldList($root = new TabSet('Root', $usersTab = new Tab('Users', _t('SecurityAdmin.Users', 'Users'), $memberList, new LiteralField('MembersCautionText', sprintf('<p class="caution-remove"><strong>%s</strong></p>', _t('SecurityAdmin.MemberListCaution', 'Caution: Removing members from this list will remove them from all groups and the' . ' database'))), new HeaderField(_t('SecurityAdmin.IMPORTUSERS', 'Import users'), 3), new LiteralField('MemberImportFormIframe', sprintf('<iframe src="%s" id="MemberImportFormIframe" width="100%%" height="250px" border="0">' . '</iframe>', $this->Link('memberimport')))), $groupsTab = new Tab('Groups', singleton('Group')->i18n_plural_name(), $groupList, new HeaderField(_t('SecurityAdmin.IMPORTGROUPS', 'Import groups'), 3), new LiteralField('GroupImportFormIframe', sprintf('<iframe src="%s" id="GroupImportFormIframe" width="100%%" height="250px" border="0">' . '</iframe>', $this->Link('groupimport'))))), new HiddenField('ID', false, 0));
     $root->setTemplate('CMSTabSet');
     // Add roles editing interface
     if (Permission::check('APPLY_ROLES')) {
         $rolesField = GridField::create('Roles', false, PermissionRole::get(), GridFieldConfig_RecordEditor::create());
         $rolesTab = $fields->findOrMakeTab('Root.Roles', _t('SecurityAdmin.TABROLES', 'Roles'));
         $rolesTab->push($rolesField);
     }
     $actionParam = $this->request->param('Action');
     if ($actionParam == 'groups') {
         $groupsTab->addExtraClass('ui-state-selected');
     } elseif ($actionParam == 'users') {
         $usersTab->addExtraClass('ui-state-selected');
     } elseif ($actionParam == 'roles') {
         $rolesTab->addExtraClass('ui-state-selected');
     }
     $actions = new FieldList();
     $form = new Form($this, 'EditForm', $fields, $actions);
     $form->addExtraClass('cms-edit-form');
     $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
     if ($form->Fields()->hasTabset()) {
         $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
     }
     $form->addExtraClass('center ss-tabset cms-tabset ' . $this->BaseCSSClasses());
     $form->setAttribute('data-pjax-fragment', 'CurrentForm');
     $this->extend('updateEditForm', $form);
     return $form;
 }
开发者ID:normann,项目名称:sapphire,代码行数:45,代码来源:SecurityAdmin.php


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