本文整理汇总了PHP中FieldGroup::create方法的典型用法代码示例。如果您正苦于以下问题:PHP FieldGroup::create方法的具体用法?PHP FieldGroup::create怎么用?PHP FieldGroup::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FieldGroup
的用法示例。
在下文中一共展示了FieldGroup::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCMSFields
public function getCMSFields()
{
//Fetch curret fields and store in Fields
$fields = parent::getCMSFields();
//Remove Fields
$fields->removeFieldFromTab("Root.Main", array("SortOrder", "CalendarID", "Title", "Content", "StartDate", "StartTime", "EndDate", "EndTime", "Location"));
//Event Title
$Title = new TextField("Title", "Event Title");
$Title->setRightTitle("Enter the event title. i.e. sports day.");
//Start Date & Time
$StartDate = new DateField("StartDate", "Start Date");
$StartDate->setConfig('showcalendar', 1);
$StartDate->setConfig('dateformat', 'dd/MM/YYYY');
$StartTime = new TimeField("StartTime", "Start Time (Optional)");
$StartTime->setConfig('use_strtotime', 1);
//End Date & Time
$EndDate = new DateField("EndDate", "End Date (Optional)");
$EndDate->setConfig('showcalendar', 1);
$EndDate->setConfig('dateformat', 'dd/MM/YYYY');
$EndTime = new TimeField("EndTime", "End Time (Optional)");
$StartTime->setConfig('use_strtotime', 1);
//Location
$Location = new AddressTextField("Location", "Event Location", "AIzaSyA-folYpPWGiFcpBZURJpf610nO6FJtqqQ");
$Location->SetRightTitle("Optional. Begin typing and you will see address suggestions (Beta). Powered by Google.");
$Location->addExtraClass("text");
//Event Description
$Description = new HTMLEditorField("Content", "Event Description");
//Group Start and End Date & Time Fields
$Times = FieldGroup::create($StartDate, $StartTime, $EndDate, $EndTime)->setTitle('Timings');
//Add Fields to the CMS
$fields->addFieldsToTab("Root.Main", array($Title, $Times, $Location, $Description));
//Return Fields to the CMS
return $fields;
}
示例2: getCMSFields
/**
* @return FieldList
*/
public function getCMSFields()
{
/** =========================================
* @var FieldList $fields
* @var FieldGroup $settings
* @var UploadField $image
* @var GridFieldConfig_RelationEditor $config
* @var GridField $gridField
===========================================*/
$fields = FieldList::create(TabSet::create('Root'));
$fields->addfieldToTab('Root.Main', $title = TextField::create('Title'));
$title->setRightTitle('Title used in the cms as a visual cue for this piece of content.');
$fields->addFieldToTab('Root.Main', $settings = FieldGroup::create(array(CheckboxField::create('IsFullWidth', 'Container full width'))));
$settings->setTitle('Settings');
$fields->addFieldToTab('Root.Main', HeaderField::create('', 'Style'));
$fields->addFieldToTab('Root.Main', DesignField::create('Style', 'Container', '.container', array('padding-top' => 'TextField', 'padding-bottom' => 'TextField', 'margin-top' => 'TextField', 'margin-bottom' => 'TextField', 'color' => 'ColorField', 'background' => 'ColorField')));
$fields->addFieldToTab('Root.Main', HeaderField::create('', 'Background (optional)', 4));
$fields->addFieldToTab('Root.Main', $image = UploadField::create('Image', _t('PageBuilderContainer.IMAGE', 'Image')));
$image->setAllowedExtensions(array('jpeg', 'jpg', 'gif', 'png'));
$image->setFolderName('Uploads/site-builder/containers');
$fields->addFieldToTab('Root.Main', DropdownField::create('BackgroundType', 'Type', $this->dbObject('BackgroundType')->enumValues()));
$config = GridFieldConfig_RelationEditor::create(10);
$config->addComponent(GridFieldOrderableRows::create('SortOrder'))->addComponent(new GridFieldDeleteAction());
$gridField = GridField::create('Items', 'Items', $this->Items(), $config);
$gridField->addExtraClass('hide');
$fields->addFieldToTab('Root.Main', $gridField);
return $fields;
}
示例3: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
// Main Content tab
// Carousel tab
$carouselItemsGrid = null;
// Manay to many relations can only be established if we have an id. So put a place holder instead of a grid if this is a new object.
if ($this->ID == 0) {
$carouselItemsGrid = TextField::create("CarouselItems", "Carousel Items")->setDisabled(true)->setValue("Page must be saved once before adding Carousel Items.");
} else {
$carouselItemsGrid = new GridField('CarouselItems', 'Carousel', $this->CarouselItems()->sort('Archived'), GridFieldConfig_RelationEditor::create());
$carouselItemsGridUploadComponent = new GridFieldBulkUpload("Image");
$carouselItemsGridUploadComponent->setUfSetup("setFolderName", $this->ImageFolder("carousel"));
$carouselItemsGrid->setModelClass('CarouselItem')->getConfig()->addComponent($carouselItemsGridUploadComponent)->addComponent(new GridFieldOrderableRows("SortID"));
}
$fields->addFieldToTab('Root.Carousel', $carouselItemsGrid);
// Links
$fields->addFieldToTab('Root.Links', new TreeDropdownField('LearnMorePageID', 'Page to link the "Learn More" button to:', 'SiteTree'));
$fields->addFieldToTab('Root.Links', new TextField('LearnMoreButtonText', 'Text to display on the "Learn More" button:', 'SiteTree'));
$quickLinksGrid = new GridField('Quicklinks', 'Quicklinks', $this->Quicklinks(), GridFieldConfig_RelationEditor::create());
$quickLinksGrid->setModelClass('Quicklink');
$quickLinksFieldGroup = FieldGroup::create($quickLinksGrid)->setTitle('Quick Links');
$quickLinksFieldGroup->setName("QuicklinkGroup");
$fields->addFieldToTab('Root.Links', $quickLinksFieldGroup);
$fields->removeByName('Translations');
$fields->removeByName('Import');
$fields->addFieldToTab('Root.Features', ToggleCompositeField::create('FeatureOne', _t('SiteTree.FeatureOne', 'Feature One'), array(new TextField('FeatureOneTitle', 'Title'), new DropdownField('FeatureOneCategory', 'Category', singleton('ExpressHomePage')->dbObject('FeatureOneCategory')->enumValues()), new HTMLEditorField('FeatureOneContent', 'Content'), new TreeDropdownField('FeatureOneLinkID', 'Page to link to', 'SiteTree'), new TextField('FeatureOneButtonText', 'Button text')))->setHeadingLevel(3));
$fields->addFieldToTab('Root.Features', ToggleCompositeField::create('FeatureTwo', _t('SiteTree.FeatureTwo', 'Feature Two'), array(new TextField('FeatureTwoTitle', 'Title'), new DropdownField('FeatureTwoCategory', 'Category', singleton('ExpressHomePage')->dbObject('FeatureTwoCategory')->enumValues()), new HTMLEditorField('FeatureTwoContent', 'Content'), new TreeDropdownField('FeatureTwoLinkID', 'Page to link to', 'SiteTree'), new TextField('FeatureTwoButtonText', 'Button text')))->setHeadingLevel(3));
return $fields;
}
示例4: getSettingsFields
public function getSettingsFields()
{
$fields = parent::getSettingsFields();
$gallery = FieldGroup::create(CheckboxField::create('HideDescription', 'Hide the description of each image?'))->setTitle('Gallery');
$fields->addFieldToTab('Root.Settings', $gallery);
return $fields;
}
示例5: updateSettingsFields
function updateSettingsFields(FieldList $fields)
{
$children = FieldGroup::create(CheckboxField::create('ShowChildren', 'Show children in the content area?'))->setTitle('Children of this page');
$fields->addFieldToTab('Root.Settings', $children);
$contact = FieldGroup::create(CheckboxField::create('ShowContact', 'Show contact info on this page?'))->setTitle('Contact Info (from settings)');
$fields->addFieldToTab('Root.Settings', $contact);
}
示例6: updateCMSFields
public function updateCMSFields(\FieldList $fields)
{
if (!Config::inst()->get('VersionFeed', 'allchanges_enabled')) {
return;
}
$fields->addFieldToTab('Root.Access', FieldGroup::create(new CheckboxField('AllChangesEnabled', $this->owner->fieldLabel('AllChangesEnabled')))->setTitle(_t('VersionFeedSiteConfig.ALLCHANGES', 'All page changes'))->setDescription(_t('VersionFeed.Warning', "Publicising the history will also disclose the changes that have at the time been protected " . "from the public view.")));
}
示例7: updateSettingsFields
/**
* @param FieldList $fields
* @return FieldList
*/
public function updateSettingsFields(FieldList $fields)
{
/** @var FieldGroup $hideDefaultSlider */
$fields->addFieldToTab('Root.Settings', $hideDefaultSlider = FieldGroup::create(CheckboxField::create('HideDefaultSlider', 'Hide the slider from this page')));
$hideDefaultSlider->setTitle('Slider');
return $fields;
}
示例8: 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");
}
$this->extend("updateCMSFields", $fields, $params);
if ($count = $this->getUseCount()) {
$fields->addFieldsToTab("Root.Usage", array(HeaderField::create("UseCount", sprintf("This discount has been used {$count} time%s.", $count > 1 ? "s" : "")), HeaderField::create("TotalSavings", sprintf("A total of %s has been saved by customers using this discount.", $this->SavingsTotal), "3"), 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->removeByName("Type");
} elseif ($this->Type && (double) $this->{$this->Type}) {
$valuefield = $this->Type == "Percent" ? $percentfield : $amountfield;
$fields->removeByName("Type");
$fields->insertAfter($valuefield, "ActionTitle");
$fields->replaceField($this->Type, $valuefield->performReadonlyTransformation());
if ($this->Type == "Percent") {
$fields->insertAfter($maxamountfield, "Percent");
}
}
return $fields;
}
示例9: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
// Remove fields
$fields->removeByName(array('Unique', 'Permanent', 'CanClose', 'CloseColor', 'LinkID'));
// Add fields
// Main tab
$fields->addFieldToTab("Root.Main", $test = TextField::create("ButtonText")->setTitle(_t("SiteMessage.LABELBUTTONTEXT", "Button Text")));
$fields->addFieldToTab("Root.Main", TreeDropdownField::create("PageID")->setTitle(_t("SiteMessage.LABELLINKTO", "Link to"))->setSourceObject("SiteTree"));
$fields->addFieldToTab("Root.Main", HTMLEditorField::create("Content")->setTitle(_t("SiteMessage.LABELCONTENT", "Message content"))->setRows(15));
// Design tab
$fields->addFieldToTab("Root.Design", HeaderField::create("ColorSettings")->setTitle(_t("SiteMessage.HEADERCOLORSETTINGS", "Color settings")));
$fields->addFieldToTab("Root.Design", ColorField::create("BackgroundColor")->setTitle(_t("SiteMessage.LABELBACKGROUNDCOLOR", "Background Color")));
$fields->addFieldToTab("Root.Design", ColorField::create("TextColor")->setTitle(_t("SiteMessage.LABELTEXTCOLOR", "Text Color")));
$fields->addFieldToTab("Root.Design", ColorField::create("ButtonColor")->setTitle(_t("SiteMessage.LABELBUTTONCOLOR", "Button Color")));
$fields->addFieldToTab("Root.Design", ColorField::create("ButtonTextColor")->setTitle(_t("SiteMessage.LABELBUTTONTEXTCOLOR", "Button Text Color")));
$fields->addFieldToTab("Root.Design", HeaderField::create("CloseSettings")->setTitle(_t("SiteMessage.HEADERCLOSESETTINGS", "Close button settings")));
$fields->addFieldToTab("Root.Design", FieldGroup::create(_t("SiteMessage.LABELCANCLOSE", "Show close button?"), Checkboxfield::create("CanClose", "")));
$fields->addFieldToTab("Root.Design", ColorField::create("CloseColor")->setTitle(_t("SiteMessage.LABELCLOSECOLOR", "Close button color")));
// Schedule tab
$fields->addFieldToTab("Root.Schedule", FieldGroup::create(_t("SiteMessage.LABELPERMANENT", "Is this message permanent?"), CheckboxField::create("Permanent", "")));
$fields->addFieldToTab("Root.Schedule", $Start = new DatetimeField("Start"));
$fields->addFieldToTab("Root.Schedule", $End = new DatetimeField("End"));
$Start->setConfig('datavalueformat', 'YYYY-MM-dd HH:mm')->setTitle(_t("SiteMessage.LABELSTART", "Start Date"))->getDateField('Start')->setConfig('showcalendar', TRUE);
$End->setConfig('datavalueformat', 'YYYY-MM-dd HH:mm')->setTitle(_t("SiteMessage.LABELSTART", "End Date"))->getDateField('End')->setConfig('showcalendar', TRUE);
return $fields;
}
示例10: updateSettingsFields
/**
* If this extension is applied to a {@link SiteTree} record then
* append a Provide Comments checkbox to allow authors to trigger
* whether or not to display comments
*
* @todo Allow customization of other {@link Commenting} configuration
*
* @param FieldList $fields
*/
public function updateSettingsFields(FieldList $fields)
{
$options = FieldGroup::create()->setTitle(_t('CommentsExtension.COMMENTOPTIONS', 'Comments'));
// Check if enabled setting should be cms configurable
if ($this->owner->getCommentsOption('enabled_cms')) {
$options->push(new CheckboxField('ProvideComments', _t('Comment.ALLOWCOMMENTS', 'Allow Comments')));
}
// Check if we should require users to login to comment
if ($this->owner->getCommentsOption('require_login_cms')) {
$options->push(new CheckboxField('CommentsRequireLogin', _t('Comments.COMMENTSREQUIRELOGIN', 'Require login to comment')));
}
if ($options->FieldList()->count()) {
if ($fields->hasTabSet()) {
$fields->addFieldsToTab('Root.Settings', $options);
} else {
$fields->push($options);
}
}
// Check if moderation should be enabled via cms configurable
if ($this->owner->getCommentsOption('require_moderation_cms')) {
$moderationField = new DropdownField('ModerationRequired', 'Comment Moderation', array('None' => _t('CommentsExtension.MODERATIONREQUIRED_NONE', 'No moderation required'), 'Required' => _t('CommentsExtension.MODERATIONREQUIRED_REQUIRED', 'Moderate all comments'), 'NonMembersOnly' => _t('CommentsExtension.MODERATIONREQUIRED_NONMEMBERSONLY', 'Only moderate non-members')));
if ($fields->hasTabSet()) {
$fields->addFieldsToTab('Root.Settings', $moderationField);
} else {
$fields->push($moderationField);
}
}
}
示例11: getCMSFields
public function getCMSFields()
{
$datetimeField = DatetimeField::create("Date")->setTitle($this->fieldLabel("Date"));
$datetimeField->getDateField()->setConfig("dmyfields", true);
// Check if NewsImage should be saved in a seperate folder
if (self::config()->save_image_in_seperate_folder == false) {
$UploadField = UploadField::create("NewsImage")->setTitle($this->fieldLabel("NewsImage"))->setFolderName("news");
} else {
if ($this->ID == "0") {
$UploadField = FieldGroup::create(LiteralField::create("Save", $this->fieldLabel("SaveHelp")))->setTitle($this->fieldLabel("NewsImage"));
} else {
$UploadField = UploadField::create("NewsImage")->setTitle($this->fieldLabel("NewsImage"))->setFolderName("news/" . $this->URLSegment);
}
}
// Create direct link to NewsArticle
if ($this->ID == "0") {
// Little hack to hide $urlsegment when article isn't saved yet.
$urlsegment = LiteralField::create("NoURLSegmentYet", "");
} else {
if ($NewsHolder = $this->NewsHolder()) {
$baseLink = Controller::join_links(Director::absoluteBaseURL(), $NewsHolder->Link(), $this->URLSegment);
}
$urlsegment = Fieldgroup::create(LiteralField::create("URLSegment", "URLSegment")->setContent('<a href="' . $baseLink . '" target="_blank">' . $baseLink . '</a>'))->setTitle("URLSegment");
}
$fields = FieldList::create(new TabSet("Root", new Tab("Main", $urlsegment, TextField::create("Title")->setTitle($this->fieldLabel("Title")), $datetimeField, HTMLEditorField::create("Content")->setTitle($this->fieldLabel("Content")), $UploadField)));
$this->extend("updateCMSFields", $fields);
return $fields;
}
示例12: getCMSFields
/**
* Add fields to the CMS for this gateway.
*/
public function getCMSFields()
{
//Fetch the fields from the Courier DataObject
$fields = parent::getCMSFields();
//Add new fields
$fields->addFieldsToTab("Root.Main", array(HeaderField::create("PayPal Transaction Information"), CompositeField::create(ReadonlyField::create("custom", "Order Number"), ReadonlyField::create("payment_date", "Payment Date"), ReadonlyField::create("payment_status", "Payment Status")->setRightTitle("\n\t\t\t\t\tIf this status is pending, see Pending Reason below. \n\t\t\t\t"), ReadonlyField::create("payment_type", "Payment Type")->setRightTitle("\n\t\t\t\t\tFor a explanation of the different payment types please see 'payment_type' at \n\t\t\t\t\t<a href=\"https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNandPDTVariables/\">paypal.com</a>\n\t\t\t\t"), ReadonlyField::create("pending_reason", "Pending Reason")->setRightTitle("\n\t\t\t\t\tFor a explanation of pending reasons please see 'pending_reason' at \n\t\t\t\t\t<a href=\"https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNandPDTVariables/\">paypal.com</a>\n\t\t\t\t"), ReadonlyField::create("reason_code", "Reason Code")->setRightTitle("\n\t\t\t\t\tThis is set if Payment Status is Reversed, Refunded, Canceled_Reversal, or Denied. For an explanation of its\n\t\t\t\t\tmeaning see 'reason_code' at \n\t\t\t\t\t<a href=\"https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNandPDTVariables/\">paypal.com</a>\n\t\t\t\t"), FieldGroup::create("Transaction Identifiers", ReadonlyField::create("txn_id", "<strong>Transaction ID</strong>"), ReadonlyField::create("parent_txn_id", "<strong>Parent Transaction ID</strong>"))->setRightTitle("\n\t\t\t\t\t<strong>Transaction ID</strong><br />\n\t\t\t\t\tThe identifier for this specific transaction entry.\n\t\t\t\t\t\n\t\t\t\t\t<br /><br />\n\t\t\t\t\t\n\t\t\t\t\t<strong>Parent Transaction ID</strong><br />\n\t\t\t\t\tIf provided, this value is the transaction identifier of the\n\t\t\t\t\tparent transaction. i.e. If this transaction is a refund, the\n\t\t\t\t\tvalue will be the transaction ID of the original purchase.\n\t\t\t\t\t<br />\n\t\t\t\t"), FieldGroup::create("Funds", ReadonlyField::create("mc_gross", "<strong>Gross Payment</strong>"), ReadonlyField::create("mc_fee", "<strong>PayPal Fee</strong>"))->setRightTitle("\n\t\t\t\t\t<strong>Gross Payment</strong><br />\n\t\t\t\t\tFull amount of the customer's payment, before transaction fee is subtracted.\n\t\t\t\t\t\n\t\t\t\t\t<br /><br />\n\t\t\t\t\t\n\t\t\t\t\t<strong>PayPal Fee</strong><br />\n\t\t\t\t\tTransaction fee associated with the payment.\n\t\t\t\t"))));
return $fields;
}
示例13: getCMSFields
public function getCMSFields()
{
$fields = singleton('DataObject')->getCMSFields();
$type_map = $this->dbObject('MetaType')->enumValues();
$group = FieldGroup::create(FieldGroup::create(TextField::create('Telephone', 'Phone Number'), CheckboxField::create('MetaFax', 'Is Fax'), CheckboxField::create('MetaTollFree', 'Toll Free')), FieldGroup::create(TextField::create('Label', 'Label (optional)')), FieldGroup::create(DropdownField::create('MetaType', 'Meta Type', $type_map)));
$fields->addFieldToTab('Root.Main', $group);
return $fields;
}
示例14: getCMSFields
/**
* @return mixed
*/
public function getCMSFields()
{
$fields = singleton('DataObject')->getCMSFields();
$type_map = $this->config()->flexiemail_metatype;
$group = FieldGroup::create(FieldGroup::create(TextField::create('Email', 'Email address')), FieldGroup::create(TextField::create('Label', 'Label (optional)')), FieldGroup::create(DropdownField::create('MetaType', 'Meta Type', $type_map, 1)));
$fields->addFieldToTab('Root.Main', $group);
return $fields;
}
示例15: updateSettingsFields
/**
* @param FieldList $fields
* @return FieldList
*/
public function updateSettingsFields(FieldList $fields)
{
/** Use FieldGroups to set left titles for the checkboxes.
*
* @var FieldGroup $hideSidebar
*/
$fields->addFieldToTab('Root.Settings', $hideSidebar = FieldGroup::create(CheckboxField::create('HideSidebar', _t('BoilerplatePageExtension.HideSidebar', 'Hide the sidebar from this page'))));
$hideSidebar->setTitle(_t('BoilerplatePageExtension.HideSidebarTitle', 'Sidebar'));
}
开发者ID:helpfulrobot,项目名称:ryanpotter-silverstripe-boilerplate,代码行数:13,代码来源:BoilerplatePageExtension.php