本文整理汇总了PHP中FieldList::insertAfter方法的典型用法代码示例。如果您正苦于以下问题:PHP FieldList::insertAfter方法的具体用法?PHP FieldList::insertAfter怎么用?PHP FieldList::insertAfter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FieldList
的用法示例。
在下文中一共展示了FieldList::insertAfter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEditForm
/**
* Returns the edit form for this admin.
*
* @param type $id
* @param type $fields
*
* @return Form
*/
public function getEditForm($id = null, $fields = null)
{
$fields = new FieldList();
$desc = _t('SilvercartProductImageAdmin.Description');
$descriptionField = new SilvercartAlertInfoField('SilvercartProductImagesDescription', str_replace(PHP_EOL, '<br/>', $desc));
$uploadField = new UploadField('SilvercartProductImages', _t('SilvercartProductImageAdmin.UploadProductImages', 'Upload product images'));
$uploadField->setFolderName(SilvercartProductImageImporter::get_relative_upload_folder());
$fields->push($uploadField);
$fields->push($descriptionField);
if (!SilvercartProductImageImporter::is_installed()) {
$cronTitle = _t('SilvercartProductImageAdmin.CronNotInstalledTitle') . ':';
$cron = _t('SilvercartProductImageAdmin.CronNotInstalledDescription');
$cronjobInfoField = new SilvercartAlertDangerField('SilvercartProductImagesCronjobInfo', str_replace(PHP_EOL, '<br/>', $cron), $cronTitle);
$fields->insertAfter('SilvercartProductImages', $cronjobInfoField);
} elseif (SilvercartProductImageImporter::is_running()) {
$cronTitle = _t('SilvercartProductImageAdmin.CronIsRunningTitle') . ':';
$cron = _t('SilvercartProductImageAdmin.CronIsRunningDescription');
$cronjobInfoField = new SilvercartAlertSuccessField('SilvercartProductImagesCronjobInfo', str_replace(PHP_EOL, '<br/>', $cron), $cronTitle);
$fields->insertAfter('SilvercartProductImages', $cronjobInfoField);
}
$uploadedFiles = $this->getUploadedFiles();
if (count($uploadedFiles) > 0) {
$uploadedFilesInfo = '<br/>' . implode('<br/>', $uploadedFiles);
$fileInfoField = new SilvercartAlertWarningField('SilvercartProductImagesFileInfo', $uploadedFilesInfo, _t('SilvercartProductImageAdmin.FileInfoTitle'));
$fields->insertAfter('SilvercartProductImages', $fileInfoField);
}
$actions = new FieldList();
$form = new Form($this, "EditForm", $fields, $actions);
$form->addExtraClass('cms-edit-form cms-panel-padded center ' . $this->BaseCSSClasses());
$form->loadDataFrom($this->request->getVars());
$this->extend('updateEditForm', $form);
return $form;
}
示例2: getCMSFields
public function getCMSFields($params = null)
{
//fields that shouldn't be changed once coupon is used
$fields = new FieldList(array($tabset = new TabSet("Root", $maintab = new Tab("Main", TextField::create("Title"), CheckboxField::create("Active", "Active")->setDescription("Enable/disable all use of this discount."), HeaderField::create("ActionTitle", "Action", 3), $typefield = SelectionGroup::create("Type", array(new SelectionGroup_Item("Percent", $percentgroup = FieldGroup::create($percentfield = NumericField::create("Percent", "Percentage", "0.00")->setDescription("e.g. 0.05 = 5%, 0.5 = 50%, and 5 = 500%"), $maxamountfield = CurrencyField::create("MaxAmount", _t("MaxAmount", "Maximum Amount"))->setDescription("The total allowable discount. 0 means unlimited.")), "Discount by percentage"), new SelectionGroup_Item("Amount", $amountfield = CurrencyField::create("Amount", "Amount", "\$0.00"), "Discount by fixed amount")))->setTitle("Type"), OptionSetField::create("For", "Applies to", array("Order" => "Entire Order", "Cart" => "Cart Subtotal", "Shipping" => "Shipping Subtotal", "Items" => "Each Individual Item")), new Tab("Main", HeaderField::create("ConstraintsTitle", "Constraints", 3), LabelField::create("ConstraintsDescription", "Configure the requirements an order must meet for this discount to be valid:")), new TabSet("Constraints")))));
if (!$this->isInDB()) {
$fields->addFieldToTab("Root.Main", LiteralField::create("SaveNote", "<p class=\"message good\">More constraints will show up after you save for the first time.</p>"), "Constraints");
}
if ($count = $this->getUseCount()) {
$fields->addFieldsToTab("Root.Usage", array(HeaderField::create("UseCount", sprintf("This discount has been used {$count} time%s.", $count > 1 ? "s" : "")), GridField::create("Orders", "Orders", $this->getAppliedOrders(), GridFieldConfig_RecordViewer::create()->removeComponentsByType("GridFieldViewButton"))));
}
if ($params && isset($params['forcetype'])) {
$valuefield = $params['forcetype'] == "Percent" ? $percentfield : $amountfield;
$fields->insertAfter($valuefield, "Type");
$fields->makeFieldReadonly("Type");
} else {
if ($this->Type && (double) $this->{$this->Type}) {
$valuefield = $this->Type == "Percent" ? $percentfield : $amountfield;
$fields->makeFieldReadonly("Type");
$fields->insertAfter($valuefield, "ActionTitle");
$fields->replaceField($this->Type, $valuefield->performReadonlyTransformation());
if ($this->Type == "Percent") {
$fields->insertAfter($maxamountfield, "Percent");
}
}
}
$this->extend("updateCMSFields", $fields, $params);
return $fields;
}
示例3: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
if ($this->owner->Form() && $this->owner->Form() instanceof UserDefinedPaymentForm) {
$fields->insertAfter(new CheckboxField('SendCreated', _t('UserDefinedPaymentForm.SendCreated', 'Send email for transactions that are saved as Created')), "SendPlain");
$fields->insertAfter(new CheckboxField('SendAuthorized', _t('UserDefinedPaymentForm.SendAuthorized', 'Send email for transactions that are saved as Authorized')), "SendCreated");
$fields->insertAfter(new CheckboxField('SendCaptured', _t('UserDefinedPaymentForm.SendCaptured', 'Send email for transactions that are saved as Captured')), "SendAuthorized");
$fields->insertAfter(new CheckboxField('SendRefunded', _t('UserDefinedPaymentForm.SendRefunded', 'Send email for transactions that are saved as Refunded')), "SendCaptured");
$fields->insertAfter(new CheckboxField('SendVoid', _t('UserDefinedPaymentForm.SendVoid', 'Send email for transactions that are saved as Void')), "SendRefunded");
}
}
开发者ID:helpfulrobot,项目名称:souldigital-silverstripe-userforms-payments,代码行数:10,代码来源:UserDefinedPaymentFormEmailRecipientExtension.php
示例4: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$group = Group::get()->filter(array('code' => BlogEntry::config()->defaultGroup))->first();
$contentAuthors = $group->Members()->map('ID', 'Title');
$fields->insertAfter(HTMLEditorField::create("Summary")->setRows(4), "Content");
$fields->insertAfter(UploadField::create("FeatureImage"), "Summary");
$fields->insertAfter(DropdownField::create('AuthorMemberID', 'Author (Member)', $contentAuthors)->setEmptyString('(Select one)'), 'Date');
$fields->removeByName('Author');
$fields->insertAfter(TextField::create('Author', "Guest Author"), "AuthorMemberID");
}
示例5: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$fields->removeByName('LastSignificantChange');
$fields->removeByName('ChangeDescription');
if ($this->owner->LastSignificantChange !== NULL) {
$dateTime = new DateTime($this->owner->LastSignificantChange);
//Put these fields on the top of the First Tab's form
$fields->first()->Tabs()->first()->getChildren()->unshift(LabelField::create("infoLastSignificantChange", "<strong>Last Significant change was at: " . "{$dateTime->Format('d/m/Y H:i')}</strong>"));
$fields->insertAfter(CheckboxField::create("isSignificantChange", "CLEAR Last Significant change: {$dateTime->Format('d/m/Y H:i')}")->setDescription('Check and save this Record again to clear the Last Significant change date.')->setValue(FALSE), 'infoLastSignificantChange');
$fields->insertAfter(TextField::create('ChangeDescription', 'Description of Changes')->setDescription('This is an automatically generated list of changes to important fields.'), 'isSignificantChange');
}
}
开发者ID:helpfulrobot,项目名称:silverstripe-australia-datachange-tracker,代码行数:12,代码来源:SignificantChangeRecordable.php
示例6: updateCMSFields
/**
* Add URL field and a read-only External ID field to CMS form.
*
* @param FieldList $fields
*/
public function updateCMSFields(FieldList $fields)
{
$descriptionFieldName = $this->getModelFieldName(self::DescriptionFieldName);
$fields->insertBefore(new TextField($this->linkFieldName(), 'Feed URL'), $descriptionFieldName);
$fields->insertAfter(new DropdownField(self::FeedTypeFieldName, 'Type', static::feed_types()), $descriptionFieldName);
$fields->insertAfter($field = new TextField(self::XPathFieldName, 'XPath'), $descriptionFieldName);
$field->setAttribute('placeholder', $this->defaultXPath());
$fields->insertAfter(new CheckboxField(self::ValidateFeedFieldName, 'Validate feed', true), $descriptionFieldName);
if ($idFieldName = $this->externalIDFieldName()) {
if ($externalID = $this->owner->{$idFieldName}) {
$fields->push(new LiteralField($externalID, 'Feed ID', "<p>{$externalID}</p>"));
}
}
}
示例7: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
if ($this->owner->ID) {
$srcTags = function () {
$tags = array();
foreach (DMSTag::get() as $t) {
$tags[$t->ID] = $t->Category . ($t->isValueDefined() ? ' -> ' . $t->Value : '');
}
return $tags;
};
$selectTags = ListboxField::create('DocumentTags', _t('DMSDocumentExtension.Tags', 'Tags'), $srcTags(), implode(',', $this->owner->Tags()->column()), null, true)->useAddNew('DMSTag', $srcTags, FieldList::create(TextField::create('Category', _t('DMSDocumentExtension.Category', 'Category *')), TextField::create('Value', _t('DMSDocumentExtension.Value', 'Value')), HiddenField::create('MultiValue', null, 1)));
$fields->insertAfter($selectTags, 'Description');
$fields->insertAfter(CheckboxField::create('ShowTagsFrontend', _t('DMSDocumentExtension.ShowTagsFrontend', 'Show document tags in frontend?')), 'DocumentTags');
}
}
示例8: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$logo = $fields->dataFieldByName('Logo');
$fields->removeByName('ParentID');
$fields->removeByName('Sort');
$fields->insertAfter($logo, 'Title');
}
示例9: updateFieldsForFile
public function updateFieldsForFile(FieldList $fields, $url, $file)
{
if (!($apiKey = Config::inst()->get('Aviary', 'ClientID'))) {
return;
}
// load Aviary (js+css)
Aviary::loadAviary();
// Image pointer
$aviaryImage = LiteralField::create('AviaryImage', '<img class="aviary_image" id="aviary_image_' . $file->ID . '" src="/' . $url . '" style="display: none;" />');
// create edit button
$editButton = FormAction::create('AviaryEditImage', _t('Aviary.EditImage', 'Edit Image'))->setAttribute('data-apikey', $apiKey)->setAttribute('data-localprocessing', Config::inst()->get('Aviary', 'LocalProcessing'));
if (!$fields->fieldByName('FilePreview.FilePreviewImage.AviaryEditImageWrapper') && ($previewRoot = $fields->fieldByName('FilePreview.FilePreviewImage.ImageFull'))) {
$fields->insertAfter(CompositeField::create($editButton)->setName('AviaryEditImageWrapper'), $previewRoot->getName());
$fields->insertAfter($aviaryImage, 'FilePreviewImage');
}
}
示例10: updateCMSFields
/**
* Adds the field editor to the page.
*
* @return FieldList
*/
public function updateCMSFields(FieldList $fields)
{
$fieldEditor = $this->getFieldEditorGrid();
$fields->insertAfter(new Tab('FormFields', _t('UserFormFieldEditorExtension.FORMFIELDS', 'Form Fields')), 'Main');
$fields->addFieldToTab('Root.FormFields', $fieldEditor);
return $fields;
}
示例11: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$fields->removeByName(array('Lat', 'Lng'));
// Adds Lat/Lng fields for viewing in the CMS
$compositeField = CompositeField::create();
$compositeField->push($overrideField = CheckboxField::create('LatLngOverride', 'Override Latitude and Longitude?'));
$overrideField->setDescription('Check this box and save to be able to edit the latitude and longitude manually.');
if ($this->owner->Lng && $this->owner->Lat) {
$googleMapURL = 'http://maps.google.com/?q=' . $this->owner->Lat . ',' . $this->owner->Lng;
$googleMapDiv = '<div class="field"><label class="left" for="Form_EditForm_MapURL_Readonly">Google Map</label><div class="middleColumn"><a href="' . $googleMapURL . '" target="_blank">' . $googleMapURL . '</a></div></div>';
$compositeField->push(LiteralField::create('MapURL_Readonly', $googleMapDiv));
}
if ($this->owner->LatLngOverride) {
$compositeField->push(TextField::create('Lat', 'Lat'));
$compositeField->push(TextField::create('Lng', 'Lng'));
} else {
$compositeField->push(ReadonlyField::create('Lat_Readonly', 'Lat', $this->owner->Lat));
$compositeField->push(ReadonlyField::create('Lng_Readonly', 'Lng', $this->owner->Lng));
}
if ($this->owner->hasExtension('Addressable')) {
// If using addressable, put the fields with it
$fields->addFieldToTab('Root.Address', ToggleCompositeField::create('Coordinates', 'Coordinates', $compositeField));
} else {
if ($this->owner instanceof SiteTree) {
// If SIteTree but not using Addressable, put after 'Metadata' toggle composite field
$fields->insertAfter($compositeField, 'ExtraMeta');
} else {
$fields->addFieldToTab('Root.Main', ToggleCompositeField::create('Coordinates', 'Coordinates', $compositeField));
}
}
}
示例12: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$service = ServiceDefinition::get();
if ($service->Count() > 0) {
$fields->insertAfter($serviceOptions = new DropdownField('ServiceID', 'Service', $service->map('ID', 'Title')), 'Title');
$serviceOptions->setEmptyString(' ');
} else {
$fields->removeByName('ServiceID');
}
$type = TypeDefinition::get();
if ($type->Count() > 0) {
$fields->insertAfter($typeOptions = new DropdownField('TypeID', 'Type', $type->map('ID', 'Title')), 'Title');
$typeOptions->setEmptyString(' ');
} else {
$fields->removeByName('TypeID');
}
}
示例13: updateProductCMSFields
/**
* Add fields for this discount to CMS form.
*
* @param FieldList $fields
*/
public function updateProductCMSFields(FieldList $fields)
{
array_map(function ($fieldName) use(&$fields) {
if ($fieldName) {
$fields->insertAfter(new NumericField($fieldName, $this->fieldLabel($fieldName)), 'Price');
}
}, array_keys(static::field_specs()));
}
示例14: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
if ($this->owner instanceof SiteTree) {
$tabName = "Root.Main";
$fieldName = "FeaturedProduct";
if (!$this->owner->Variations()->exists()) {
$fields->addFieldToTab($tabName, new NumericField('Stock', 'Stock'), $fieldName);
$fields->addFieldToTab($tabName, new CheckboxField('UnlimitedStock', 'Unlimited Stock? (over-rides Stock field above)'), $fieldName);
} else {
$fields->addFieldToTab($tabName, new LiteralField('note', '<p>Because you have one or more variations, the stock is a calculation of all stock levels</p><h4>Total Variations in Stock: ' . $this->getVariationsStock() . '</h4>'), $fieldName);
}
} else {
// it's a variation and hopefully has fields
$fields->insertAfter(new NumericField('Stock', 'Stock'), "Price");
$fields->insertAfter(new CheckboxField('UnlimitedStock', 'Unlimited Stock? (over-rides Stock field above)'), "Stock");
}
}
示例15: __construct
public function __construct($controller, $name)
{
$fields = new FieldList(TextField::create("Name"), EmailField::create("Email")->setAttribute('type', 'email'), TextareaField::create("Company", "Message")->setAttribute('autocomplete', 'no'), TextareaField::create("EmailMessage", "Company")->addExtraClass("honeypot")->setAttribute('autocomplete', 'no'));
if (!class_exists('FormSpamProtectionExtension')) {
$fields->insertAfter(HiddenField::create("TimeLog", '', time()), 'EmailMessage');
}
$actions = new FieldList(FormAction::create("doSubmit")->setTitle("Submit")->addExtraClass('button')->setUseButtonTag(true));
parent::__construct($controller, $name, $fields, $actions);
}