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


PHP Form::setFormAction方法代码示例

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


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

示例1: getGoogleSiteSearchForm

 /**
  * returns the form
  * @return Form
  */
 public function getGoogleSiteSearchForm($name = "GoogleSiteSearchForm")
 {
     $formIDinHTML = "Form_" . $name;
     if ($page = GoogleCustomSearchPage::get()->first()) {
         Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
         Requirements::javascript('googlecustomsearch/javascript/GoogleCustomSearch.js');
         $apiKey = Config::inst()->get("GoogleCustomSearchExt", "api_key");
         $cxKey = Config::inst()->get("GoogleCustomSearchExt", "cx_key");
         if ($apiKey && $cxKey) {
             Requirements::customScript("\n\t\t\t\t\t\tGoogleCustomSearch.apiKey = '" . $apiKey . "';\n\t\t\t\t\t\tGoogleCustomSearch.cxKey = '" . $cxKey . "';\n\t\t\t\t\t\tGoogleCustomSearch.formSelector = '#" . $formIDinHTML . "';\n\t\t\t\t\t\tGoogleCustomSearch.inputFieldSelector = '#" . $formIDinHTML . "_search';\n\t\t\t\t\t\tGoogleCustomSearch.resultsSelector = '#" . $formIDinHTML . "_Results';\n\t\t\t\t\t", "GoogleCustomSearchExt");
             $form = new Form($this->owner, 'GoogleSiteSearchForm', new FieldList($searchField = new TextField('search'), $resultField = new LiteralField($name . "_Results", "<div id=\"" . $formIDinHTML . "_Results\"></div>")), new FieldList(new FormAction('doSearch', _t("GoogleCustomSearchExt.GO", "Full Results"))));
             $form->setFormMethod('GET');
             if ($page = GoogleCustomSearchPage::get()->first()) {
                 $form->setFormAction($page->Link());
             }
             $form->disableSecurityToken();
             $form->loadDataFrom($_GET);
             $searchField->setAttribute("autocomplete", "off");
             $form->setAttribute("autocomplete", "off");
             return $form;
         } else {
             user_error("You must set an API Key and a CX key in your configs to use the Google Custom Search Form", E_USER_NOTICE);
         }
     } else {
         user_error("You must create a GoogleCustomSearchPage first.", E_USER_NOTICE);
     }
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-googlecustomsearch,代码行数:31,代码来源:GoogleCustomSearchExt.php

示例2: PayForm

 /**
  * Return the payment form
  */
 public function PayForm()
 {
     $request = $this->getRequest();
     $response = Session::get('EwayResponse');
     $months = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12');
     $years = range(date('y'), date('y') + 10);
     //Note: years beginning with 0 might cause issues
     $amount = $response->Payment->TotalAmount;
     $amount = number_format($amount / 100, 2);
     $currency = $response->Payment->CurrencyCode;
     $fields = new FieldList(HiddenField::create('EWAY_ACCESSCODE', '', $response->AccessCode), TextField::create('PayAmount', 'Amount', $amount . ' ' . $currency)->setDisabled(true), $nameField = TextField::create('EWAY_CARDNAME', 'Card holder'), $numberField = TextField::create('EWAY_CARDNUMBER', 'Card Number'), $expMonthField = DropdownField::create('EWAY_CARDEXPIRYMONTH', 'Expiry Month', array_combine($months, $months)), $expYearField = DropdownField::create('EWAY_CARDEXPIRYYEAR', 'Expiry Year', array_combine($years, $years)), $cvnField = TextField::create('EWAY_CARDCVN', 'CVN Number'), HiddenField::create('FormActionURL', '', $response->FormActionURL));
     //Test data
     if (Director::isDev()) {
         $nameField->setValue('Test User');
         $numberField->setValue('4444333322221111');
         $expMonthField->setValue('12');
         $expYearField->setValue(date('y') + 1);
         $cvnField->setValue('123');
     }
     $actions = new FieldList(FormAction::create('', 'Process'));
     $form = new Form($this, 'PayForm', $fields, $actions);
     $form->setFormAction($response->FormActionURL);
     Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js');
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js');
     Requirements::javascript('payment-eway/javascript/eway-form.js');
     $this->extend('updatePayForm', $form);
     return $form;
 }
开发者ID:helpfulrobot,项目名称:internetrix-silverstripe-payment-eway,代码行数:31,代码来源:Rapid.php

示例3: 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

示例4: Form

 public function Form()
 {
     $fields = new FieldList(new TextField('Name'), new EmailField('Email'), new TextareaField('Message'));
     $actions = new FieldList(new FormAction('submit', 'Submit'));
     $form = new Form($this, 'form', $fields, $actions);
     $form->setFormAction('/blocks/form');
     $form->setFormMethod('POST');
     return $form;
 }
开发者ID:helpfulrobot,项目名称:kendu-silverstripe-content-blocks,代码行数:9,代码来源:_FormBlock.php

示例5: updateEditForm

 public function updateEditForm(Form $form)
 {
     $locale = isset($_REQUEST['locale']) ? $_REQUEST['locale'] : $_REQUEST['Locale'];
     if (!empty($locale) && i18n::validate_locale($locale) && singleton('SiteConfig')->has_extension('Translatable') && (Translatable::get_allowed_locales() === null || in_array($locale, (array) Translatable::get_allowed_locales(), false)) && $locale != Translatable::get_current_locale()) {
         $orig = Translatable::get_current_locale();
         Translatable::set_current_locale($locale);
         $formAction = $form->FormAction();
         $form->setFormAction($formAction);
         Translatable::set_current_locale($orig);
     }
 }
开发者ID:memdev,项目名称:siteconfig-translatable-fix,代码行数:11,代码来源:SiteConfigTranslatableFix.php

示例6: Form

 function Form()
 {
     $query = $this->request->getVar("search");
     $fields = new FieldList(new TextField("search", "", $query));
     $actions = new FieldList($searchaction = new FormAction("index", "Search"));
     $searchaction->setFullAction(null);
     $form = new Form($this, "SearchForm", $fields, $actions);
     $form->setFormAction($this->Link());
     $form->setFormMethod("GET");
     $form->disableSecurityToken();
     return $form;
 }
开发者ID:helpfulrobot,项目名称:burnbright-silverstripe-shop-productfinder,代码行数:12,代码来源:ProductFinder.php

示例7: TranslationForm

 /**
  * Builds the entry form so the user can choose what to export.
  */
 function TranslationForm()
 {
     $fields = new FieldList();
     $fields->push(new LanguageDropdownField('From', 'From language'));
     $fields->push(new LanguageDropdownField('To', 'To language'));
     $fields->push(new CheckboxField('Mangle', 'Mangle with ROT13'));
     // Create actions for the form
     $actions = new FieldList(new FormAction("translate", "Translate"));
     $form = new Form($this, "TranslationForm", $fields, $actions);
     $form->setFormAction(Director::baseURL() . 'dev/data/translate/EntireSiteTranslator/TranslationForm');
     return $form;
 }
开发者ID:helpfulrobot,项目名称:silverstripe-testdata,代码行数:15,代码来源:EntireSiteTranslator.php

示例8: getGoogleSiteSearchForm

 /**
  * Return a form which sends the user to the first results page. If you want
  * to customize this form, use your own extension and apply that to the
  * page.
  *
  * @return Form
  */
 public function getGoogleSiteSearchForm()
 {
     if ($page = GoogleSiteSearchPage::get()->first()) {
         $label = Config::inst()->get('GoogleSiteSearchDefaultFormExtension', 'submit_button_label');
         $formLabel = Config::inst()->get('GoogleSiteSearchDefaultFormExtension', 'input_label');
         $form = new Form($this, 'GoogleSiteSearchForm', new FieldList(new TextField('Search', $formLabel)), new FieldList(new FormAction('doSearch', $label)));
         $form->setFormMethod('GET');
         $form->setFormAction($page->Link());
         $form->disableSecurityToken();
         $form->loadDataFrom($_GET);
         return $form;
     }
 }
开发者ID:helpfulrobot,项目名称:dnadesign-silverstripe-googlesitesearch,代码行数:20,代码来源:GoogleSiteSearchDefaultFormExtension.php

示例9: ExportForm

 /**
  * Builds the entry form so the user can choose what to export.
  */
 function ExportForm()
 {
     $fields = new FieldList();
     // Display available yml files so we can re-export easily.
     $ymlDest = BASE_PATH . '/' . TestDataController::get_data_dir();
     $existingFiles = scandir($ymlDest);
     $ymlFiles = array();
     foreach ($existingFiles as $file) {
         if (preg_match("/.*\\.yml/", $file)) {
             $ymlFiles[$file] = $file;
         }
     }
     if ($ymlFiles) {
         $fields->push(new DropdownField('Reexport', 'Reexport to file (will override any other setting): ', $ymlFiles, '', null, '-- choose file --'));
     }
     // Get the list of available DataObjects
     $dataObjectNames = ClassInfo::subclassesFor('DataObject');
     unset($dataObjectNames['DataObject']);
     sort($dataObjectNames);
     foreach ($dataObjectNames as $dataObjectName) {
         // Skip test only classes.
         $class = singleton($dataObjectName);
         if ($class instanceof TestOnly) {
             continue;
         }
         // Skip testdata internal class
         if ($class instanceof TestDataTag) {
             continue;
         }
         // 	Create a checkbox for including this object in the export file
         $count = $class::get()->Count();
         $fields->push($class = new CheckboxField("Class[{$dataObjectName}]", $dataObjectName . " ({$count})"));
         $class->addExtraClass('class-field');
         // 	Create an ID range selection input
         $fields->push($range = new TextField("Range[{$dataObjectName}]", ''));
         $range->addExtraClass('range-field');
     }
     // Create the "traverse relations" option - whether it should automatically include relation objects even if not explicitly ticked.
     $fields->push(new CheckboxField('TraverseRelations', 'Traverse relations (implicitly includes objects, for example pulls Groups for Members): ', 1));
     // Create the option to include real files.
     $path = BASE_PATH . '/' . TestDataController::get_data_dir();
     $fields->push(new CheckboxField('IncludeFiles', "Copy real files (into {$path}files)", 0));
     // Create file name input field
     $fields->push(new TextField('FileName', 'Name of the output YML file: ', 'output.yml'));
     // Create actions for the form
     $actions = new FieldList(new FormAction("export", "Export"));
     $form = new Form($this, "ExportForm", $fields, $actions);
     $form->setFormAction(Director::baseURL() . 'dev/data/export/TestDataExporter/ExportForm');
     return $form;
 }
开发者ID:helpfulrobot,项目名称:silverstripe-testdata,代码行数:53,代码来源:TestDataExporter.php

示例10: buildLoginForm

 /**
  * @param Controller $controller
  * @param string $back_url
  * @return Form
  */
 public static function buildLoginForm(Controller $controller, $back_url = '')
 {
     if (!defined('OPENSTACKID_ENABLED') || OPENSTACKID_ENABLED == false) {
         $form = MemberAuthenticator::get_login_form($controller);
         return $form;
     } else {
         $back_url = OpenStackIdCommon::cleanBackUrl($back_url);
         $form = new Form($controller, 'OpenStackIdLoginForm', $fields = new FieldList(), $actions = new FieldList(array(new FormAction('dologin', _t('Member.BUTTONLOGIN', "Log in")))));
         $form->addExtraClass('form-fieldless');
         $form->setFormAction("/Security/login?BackURL={$back_url}");
         $form->setFormMethod('post');
         return $form;
     }
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:19,代码来源:OpenStackIdFormsFactory.php

示例11: getEditForm

 function getEditForm($id = null, $fields = null)
 {
     $list = $this->getList();
     $exportButton = new GridFieldExportButton('before');
     $exportButton->setExportColumns($this->getExportFields());
     $listField = GridField::create($this->sanitiseClassName($this->modelClass), false, $list, $fieldConfig = GridFieldConfig_RecordEditor::create($this->stat('page_length'))->removeComponentsByType('GridFieldFilterHeader'));
     // Validation
     if (singleton($this->modelClass)->hasMethod('getCMSValidator')) {
         $detailValidator = singleton($this->modelClass)->getCMSValidator();
         $listField->getConfig()->getComponentByType('DynamicTemplateGridFieldDetailForm')->setValidator($detailValidator);
     }
     $form = new Form($this, 'EditForm', new FieldList($listField, new HeaderField(_t('DynamicTemplateAdmin.IMPORTTEMPLATE', 'Import template'), 3), new LiteralField('TemplateImportFormIframe', sprintf('<iframe src="%s" id="TemplateImportFormIframe" width="100%%" height="250px" border="0"></iframe>', $this->Link('DynamicTemplate/templateimport')))), new FieldList());
     $form->addExtraClass('cms-edit-form cms-panel-padded center');
     $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
     $form->setFormAction(Controller::join_links($this->Link($this->sanitiseClassName($this->modelClass)), 'EditForm'));
     //		$form->setAttribute('data-pjax-fragment', 'DTEditForm');
     $this->extend('updateEditForm', $form);
     //		$this->getRequest()->addHeader('X-Pjax', 'CurrentForm');
     return $form;
 }
开发者ID:helpfulrobot,项目名称:silverstripe-dynamictemplate,代码行数:20,代码来源:DynamicTemplateAdmin.php

示例12: ResultsForm

 /**
  * Shows results from the "search" action in a TableListField.
  *
  * @return Form
  */
 function ResultsForm($searchCriteria)
 {
     if ($searchCriteria instanceof HTTPRequest) {
         $searchCriteria = $searchCriteria->getVars();
     }
     $summaryFields = $this->getResultColumns($searchCriteria);
     $className = $this->parentController->resultsTableClassName();
     $tf = new $className($this->modelClass, $this->modelClass, $summaryFields);
     $tf->setCustomQuery($this->getSearchQuery($searchCriteria));
     $tf->setPageSize($this->parentController->stat('page_length'));
     $tf->setShowPagination(true);
     // @todo Remove records that can't be viewed by the current user
     $tf->setPermissions(array_merge(array('view', 'export'), TableListField::permissions_for_object($this->modelClass)));
     // csv export settings (select all columns regardless of user checkbox settings in 'ResultsAssembly')
     $exportFields = $this->getResultColumns($searchCriteria, false);
     $tf->setFieldListCsv($exportFields);
     $url = '<a href=\\"' . $this->Link() . '/$ID/edit\\">$value</a>';
     $tf->setFieldFormatting(array_combine(array_keys($summaryFields), array_fill(0, count($summaryFields), $url)));
     // implemented as a form to enable further actions on the resultset
     // (serverside sorting, export as CSV, etc)
     $form = new Form($this, 'ResultsForm', new FieldSet(new HeaderField('SearchResultsHeader', _t('ModelAdmin.SEARCHRESULTS', 'Search Results'), 2), $tf), new FieldSet(new FormAction("goBack", _t('ModelAdmin.GOBACK', "Back")), new FormAction("goForward", _t('ModelAdmin.GOFORWARD', "Forward"))));
     // Include the search criteria on the results form URL, but not dodgy variables like those below
     $filteredCriteria = $searchCriteria;
     unset($filteredCriteria['ctf']);
     unset($filteredCriteria['url']);
     unset($filteredCriteria['action_search']);
     if (isset($filteredCriteria['Investors__PEFirm__IsPECMember']) && !$filteredCriteria['Investors__PEFirm__IsPECMember']) {
         unset($filteredCriteria['Investors__PEFirm__IsPECMember']);
     }
     $form->setFormAction($this->Link() . '/ResultsForm?' . http_build_query($filteredCriteria));
     return $form;
 }
开发者ID:racontemoi,项目名称:shibuichi,代码行数:37,代码来源:ModelAdmin.php

示例13: getMoveForm

 /**
  * Build snapshot move form.
  *
  * @param SS_HTTPRequest $request
  * @param DNDataArchive|null $dataArchive
  *
  * @return Form|SS_HTTPResponse
  */
 public function getMoveForm(SS_HTTPRequest $request, DNDataArchive $dataArchive = null)
 {
     $dataArchive = $dataArchive ? $dataArchive : DNDataArchive::get()->byId($request->requestVar('DataArchiveID'));
     $envs = $dataArchive->validTargetEnvironments();
     if (!$envs) {
         return $this->environment404Response();
     }
     $warningMessage = '<div class="alert alert-warning"><strong>Warning:</strong> This will make the snapshot ' . 'available to people with access to the target environment.<br>By pressing "Change ownership" you ' . 'confirm that you have considered data confidentiality regulations.</div>';
     $form = new Form($this, 'MoveForm', new FieldList(new HiddenField('DataArchiveID', null, $dataArchive->ID), new LiteralField('Warning', $warningMessage), new DropdownField('EnvironmentID', 'Environment', $envs->map())), new FieldList(FormAction::create('doMove', 'Change ownership')->addExtraClass('btn')));
     $form->setFormAction($this->getCurrentProject()->Link() . '/MoveForm');
     return $form;
 }
开发者ID:antons-,项目名称:deploynaut,代码行数:20,代码来源:DNRoot.php

示例14: CountriesForm

 public function CountriesForm()
 {
     $shopConfig = ShopConfig::get()->First();
     $fields = new FieldList($rootTab = new TabSet("Root", $tabMain = new Tab('Shipping', new HiddenField('ShopConfigSection', null, 'Countries'), new GridField('ShippingCountries', 'Shipping Countries', $shopConfig->ShippingCountries(), GridFieldConfig_RecordEditor::create()->removeComponentsByType('GridFieldFilterHeader')->removeComponentsByType('GridFieldAddExistingAutocompleter'))), new Tab('Billing', new GridField('BillingCountries', 'Billing Countries', $shopConfig->BillingCountries(), GridFieldConfig_RecordEditor::create()->removeComponentsByType('GridFieldFilterHeader')->removeComponentsByType('GridFieldAddExistingAutocompleter')))));
     $actions = new FieldList();
     $form = new Form($this, 'EditForm', $fields, $actions);
     $form->setTemplate('ShopAdminSettings_EditForm');
     $form->setAttribute('data-pjax-fragment', 'CurrentForm');
     $form->addExtraClass('cms-content cms-edit-form center ss-tabset');
     if ($form->Fields()->hasTabset()) {
         $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
     }
     $form->setFormAction(Controller::join_links($this->Link($this->sanitiseClassName($this->modelClass)), 'Countries/CountriesForm'));
     $form->loadDataFrom($shopConfig);
     return $form;
 }
开发者ID:helpfulrobot,项目名称:swipestripe-swipestripe-addresses,代码行数:16,代码来源:Addresses.php

示例15: ItemEditForm

 /**
  * Calls {@link DataObject->getCMSFields()}
  *
  * @param Int $id
  * @param FieldList $fields
  * @return Form
  */
 public function ItemEditForm($id = null, $fields = null)
 {
     if ($this->record) {
         $className = $this->getItemClassName();
         $record = null;
         if ($id && is_numeric($id)) {
             $record = DataObject::get_by_id($className, (int) $id);
         } else {
             if (!empty($_REQUEST['RecordID'])) {
                 $record = DataObject::get_by_id($className, (int) $_REQUEST['RecordID']);
             } else {
                 if (!empty($_REQUEST['ID'])) {
                     $record = DataObject::get_by_id($className, (int) $_REQUEST['ID']);
                 } else {
                     if ($this->_idField) {
                         $record = DataObject::get_by_id($className, (int) $this->_idField);
                     } else {
                         if ($id = $this->getSessionID()) {
                             $record = DataObject::get_by_id($className, $id);
                         }
                     }
                 }
             }
         }
         if (!$record) {
             $record = new $className();
         }
         $fields = $fields ? $fields : $record->getCMSFields();
         if ($fields == null) {
             user_error("getCMSFields() returned null  - it should return a FieldList object.\n                                        Perhaps you forgot to put a return statement at the end of your method?", E_USER_ERROR);
         }
         if ($record->hasMethod('getAllCMSActions')) {
             $actions = $record->getAllCMSActions();
         } else {
             $actions = $record->getCMSActions();
             // add default actions if none are defined
             if (!$actions || !$actions->Count()) {
                 if ($record->hasMethod('canEdit') && $record->canEdit()) {
                     $actions->push(FormAction::create('save', _t('CMSMain.SAVE', 'Save'))->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept'));
                 }
                 if ($record->hasMethod('canDelete') && $record->canDelete() && $record->exists()) {
                     $actions->push(FormAction::create('delete', _t('ModelAdmin.DELETE', 'Delete'))->addExtraClass('ss-ui-action-destructive'));
                 }
             }
         }
         // Use <button> to allow full jQuery UI styling
         $actionsFlattened = $actions->dataFields();
         if ($actionsFlattened) {
             foreach ($actionsFlattened as $action) {
                 $action->setUseButtonTag(true);
             }
         }
         $form = new Form($this, "ItemEditForm", $fields, $actions);
         $form->addExtraClass('cms-edit-form ContentRelationshipEditor_Form');
         $form->setAttribute('data-pjax-fragment', 'CurrentForm');
         // Set this if you want to split up tabs into a separate header row
         // if($form->Fields()->hasTabset()) {
         // 	$form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
         // }
         // Add a default or custom validator.
         // @todo Currently the default Validator.js implementation
         //  adds javascript to the document body, meaning it won't
         //  be included properly if the associated fields are loaded
         //  through ajax. This means only serverside validation
         //  will kick in for pages+validation loaded through ajax.
         //  This will be solved by using less obtrusive javascript validation
         //  in the future, see http://open.silverstripe.com/ticket/2915 and
         //  http://open.silverstripe.com/ticket/3386
         if ($record->hasMethod('getCMSValidator')) {
             $validator = $record->getCMSValidator();
             // The clientside (mainly LeftAndMain*.js) rely on ajax responses
             // which can be evaluated as javascript, hence we need
             // to override any global changes to the validation handler.
             $form->setValidator($validator);
         } else {
             $form->unsetValidator();
         }
         if ($record->hasMethod('canEdit') && !$record->canEdit()) {
             $readonlyFields = $form->Fields()->makeReadonly();
             $form->setFields($readonlyFields);
         }
         if ($record->exists()) {
             //rename to recordID so it doesn't conflict with CMSMain/LeftAndMain
             $fields->push(new HiddenField('RecordID', 'RecordID', $record->ID));
             //store in session so we can use for subfields
             $this->setSessionID($record->ID);
         }
         $form->loadDataFrom($record);
         //echo $form->getRecord()->ID;exit;
         $form->setFormAction($this->Link('ItemEditForm'));
         return $form;
     }
     return false;
//.........这里部分代码省略.........
开发者ID:webtorque7,项目名称:inpage-modules,代码行数:101,代码来源:ContentModuleRelationshipEditor.php


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