本文整理汇总了PHP中CMSForm::setResponseNegotiator方法的典型用法代码示例。如果您正苦于以下问题:PHP CMSForm::setResponseNegotiator方法的具体用法?PHP CMSForm::setResponseNegotiator怎么用?PHP CMSForm::setResponseNegotiator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMSForm
的用法示例。
在下文中一共展示了CMSForm::setResponseNegotiator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEditForm
/**
* Gets the form used for viewing a time log
*/
public function getEditForm($id = null, $fields = null)
{
$record = $this->currentPage();
if ($this->action == 'view' && $record) {
$fields = new FieldList(new HeaderField('LogHeader', _t('KapostBridgeLogViewer.VIEWING_ENTRY', '_Viewing Log Entry: {datetime}', array('datetime' => $record->dbObject('Created')->FormatFromSettings())), 3), new ReadonlyField('UserAgent', _t('KapostBridgeLogViewer.USER_AGENT', '_Requestor User Agent')), new ReadonlyField('Method', _t('KapostBridgeLogViewer.METHOD', '_Method')), ToggleCompositeField::create('RequestData', _t('KapostBridgeLogViewer.KAPOST_REQUEST', '_Kapost Request'), new FieldList(ReadonlyField::create('RequestFormatted', '')->setTemplate('KapostBridgeLogField')->addExtraClass('log-contents cms-panel-layout')))->setHeadingLevel(3), ToggleCompositeField::create('ResponseData', _t('KapostBridgeLogViewer.SILVERSTRIPE_RESPONSE', '_SilverStripe Response'), new FieldList(ReadonlyField::create('ResponseFormatted', '')->setTemplate('KapostBridgeLogField')->addExtraClass('log-contents cms-panel-layout')))->setHeadingLevel(3));
$refObj = $record->ReferenceObject;
if (!empty($refObj) && $refObj !== false && $refObj->exists()) {
if (method_exists($refObj, 'CMSEditLink')) {
$fields->insertBefore(new KapostLogLinkField('CMSEditLink', _t('KapostBridgeLogViewer.REFERENCED_OBJECT', '_Referenced Object'), $refObj->CMSEditLink(), _t('KapostBridgeLogViewer.VIEW_REFERENCED_OBJECT', '_View Referenced Object')), 'RequestData');
} else {
if ($refObj instanceof File) {
$refObjLink = Controller::join_links(LeftAndMain::config()->url_base, AssetAdmin::config()->url_segment, 'EditForm/field/File/item', $refObj->ID, 'edit');
$fields->insertBefore(new KapostLogLinkField('CMSEditLink', _t('KapostBridgeLogViewer.REFERENCED_OBJECT', '_Referenced Object'), $refObjLink, _t('KapostBridgeLogViewer.VIEW_REFERENCED_OBJECT', '_View Referenced Object')), 'RequestData');
}
}
}
} else {
$fields = new FieldList();
}
$form = new CMSForm($this, 'EditForm', $fields, new FieldList());
$form->setResponseNegotiator($this->getResponseNegotiator());
$form->addExtraClass('cms-edit-form center');
$form->setAttribute('data-layout-type', 'border');
$form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
$form->setAttribute('data-pjax-fragment', 'CurrentForm');
$form->setHTMLID('Form_EditForm');
if ($record) {
$form->loadDataFrom($record);
}
return $form;
}
开发者ID:webbuilders-group,项目名称:silverstripe-kapost-bridge-logger,代码行数:34,代码来源:KapostBridgeLogViewer.php
示例2: Form
public function Form()
{
$form = new CMSForm($this, 'Form', new FieldList(new EmailField('Email'), new TextField('SomeRequiredField'), new CheckboxSetField('Boxes', null, array('1' => 'one', '2' => 'two'))), new FieldList(new FormAction('doSubmit'), new FormAction('doSubmitValidationExempt')), new RequiredFields('Email', 'SomeRequiredField'));
$form->setValidationExemptActions(array('doSubmitValidationExempt'));
$form->setResponseNegotiator('foo');
// We aren't testing AJAX responses, so just set anything
$form->disableSecurityToken();
// Disable CSRF protection for easier form submission handling
return $form;
}