本文整理汇总了PHP中FieldList::addFieldToTab方法的典型用法代码示例。如果您正苦于以下问题:PHP FieldList::addFieldToTab方法的具体用法?PHP FieldList::addFieldToTab怎么用?PHP FieldList::addFieldToTab使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FieldList
的用法示例。
在下文中一共展示了FieldList::addFieldToTab方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
// Payment Methods
$payment_table = GridField::create('PaymentMethods', _t("CheckoutAdmin.PaymentMethods", "Payment Methods"), $this->owner->PaymentMethods(), GridFieldConfig::create()->addComponents(new GridFieldToolbarHeader(), new GridFieldAddNewButton('toolbar-header-right'), new GridFieldSortableHeader(), new GridFieldDataColumns(), new GridFieldPaginator(20), new GridFieldEditButton(), new GridFieldDeleteAction(), new GridFieldDetailForm()));
// setup compressed payment options
$payment_fields = ToggleCompositeField::create('PaymentSettings', _t("CheckoutAdmin.Payments", "Payment Settings"), array(TextField::create('PaymentNumberPrefix', _t("CheckoutAdmin.OrderPrefix", "Add prefix to order numbers"), null, 9)->setAttribute("placeholder", _t("CheckoutAdmin.OrderPrefixPlaceholder", "EG 'abc'")), TextAreaField::create('PaymentSuccessContent', _t("CheckoutAdmin.PaymentSuccessContent", "Payment successfull content"))->setRows(4)->setColumns(30)->addExtraClass('stacked'), TextAreaField::create('PaymentFailerContent', _t("CheckoutAdmin.PaymentFailerContent", "Payment failer content"))->setRows(4)->setColumns(30)->addExtraClass('stacked'), $payment_table));
// Add html description of how to edit contries
$country_html = "<div class=\"field\">";
$country_html .= "<p>First select valid countries using the 2 character ";
$country_html .= "shortcode (see http://fasteri.com/list/2/short-names-of-countries-and-iso-3166-codes).</p>";
$country_html .= "<p>You can add multiple countries seperating them with";
$country_html .= "a comma or use a '*' for all countries.</p>";
$country_html .= "</div>";
$country_html_field = LiteralField::create("CountryDescription", $country_html);
// Deal with product features
$postage_field = new GridField('PostageAreas', '', $this->owner->PostageAreas(), GridFieldConfig::create()->addComponents(new GridFieldButtonRow('before'), new GridFieldToolbarHeader(), new GridFieldTitleHeader(), new GridFieldEditableColumns(), new GridFieldDeleteAction(), new GridFieldAddNewInlineButton('toolbar-header-left')));
// Add country dropdown to inline editing
$postage_field->getConfig()->getComponentByType('GridFieldEditableColumns')->setDisplayFields(array('Title' => array('title' => 'Title', 'field' => 'TextField'), 'Country' => array('title' => 'ISO 3166 codes', 'field' => 'TextField'), 'ZipCode' => array('title' => 'Zip/Post Codes', 'field' => 'TextField'), 'Calculation' => array('title' => 'Base unit', 'callback' => function ($record, $column, $grid) {
return DropdownField::create($column, "Based on", singleton('PostageArea')->dbObject('Calculation')->enumValues())->setValue("Weight");
}), 'Unit' => array('title' => 'Unit (equals or above)', 'field' => 'NumericField'), 'Cost' => array('title' => 'Cost', 'field' => 'NumericField'), 'Tax' => array('title' => 'Tax (percentage)', 'field' => 'NumericField')));
// Setup compressed postage options
$postage_fields = ToggleCompositeField::create('PostageFields', 'Postage Options', array($country_html_field, $postage_field));
// Setup compressed postage options
$discount_fields = ToggleCompositeField::create('DiscountFields', 'Discounts', array(GridField::create('Discounts', '', $this->owner->Discounts(), GridFieldConfig_RecordEditor::create())));
// Add config sets
$fields->addFieldToTab('Root.Checkout', $payment_fields);
$fields->addFieldToTab('Root.Checkout', $postage_fields);
$fields->addFieldToTab('Root.Checkout', $discount_fields);
}
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-checkout,代码行数:29,代码来源:CheckoutSiteConfigExtension.php
示例2: updateCMSFields
public function updateCMSFields(\FieldList $fields)
{
$fields->addFieldToTab("Root.FacebookFeed", new \TextField("FBAppID", "Facebook App ID"));
$fields->addFieldToTab("Root.FacebookFeed", new \TextField("FBAppSecret", "Facebook App Secret"));
$fields->addFieldToTab("Root.FacebookFeed", new \TextField("FBAccessToken", "Facebook Access Token"));
$fields->addFieldToTab("Root.FacebookFeed", new \TextField("FBPageID", "Facebook Page ID"));
}
示例3: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$fields->addFieldToTab("Root.ContactDetails", new TextField("ContactDetailsName", "Name"));
$fields->addFieldToTab("Root.ContactDetails", new TextareaField("ContactDetailsAddress", "Address"));
$fields->addFieldToTab("Root.ContactDetails", new TextField("ContactDetailsPhone", "Phone"));
$fields->addFieldToTab("Root.ContactDetails", new EmailField("ContactDetailsEmail", "Email"));
}
示例4: getCMSFields
public function getCMSFields()
{
$conf = SiteConfig::current_site_config();
$themes = $conf->getAvailableThemes();
$theme = new DropdownField('Theme', _t('Multisites.THEME', 'Theme'), $themes);
$theme->setEmptyString(_t('Multisites.DEFAULTTHEME', '(Default theme)'));
$fields = new FieldList(new TabSet('Root', new Tab('Main', new HeaderField('SiteConfHeader', _t('Multisites.SITECONF', 'Site Configuration')), new TextField('Title', _t('Multisites.TITLE', 'Title')), new TextField('Tagline', _t('Multisites.TAGLINE', 'Tagline/Slogan')), $theme, new HeaderField('SiteURLHeader', _t('Multisites.SITEURL', 'Site URL')), new OptionsetField('Scheme', _t('Multisites.SCHEME', 'Scheme'), array('any' => _t('Multisites.ANY', 'Any'), 'http' => _t('Multisites.HTTP', 'HTTP'), 'https' => _t('Multisites.HTTPS', 'HTTPS (HTTP Secure)'))), new TextField('Host', _t('Multisites.HOST', 'Host')), new MultiValueTextField('HostAliases', _t('Multisites.HOSTALIASES', 'Host Aliases')), new CheckboxField('IsDefault', _t('Multisites.ISDEFAULT', 'Is this the default site?')), new HeaderField('SiteAdvancedHeader', _t('Multisites.SiteAdvancedHeader', 'Advanced Settings')), TextareaField::create('RobotsTxt', _t('Multisites.ROBOTSTXT', 'Robots.txt'))->setDescription(_t('Multisites.ROBOTSTXTUSAGE', '<p>Please consult <a href="http://www.robotstxt.org/robotstxt.html" target="_blank">http://www.robotstxt.org/robotstxt.html</a> for usage of the robots.txt file.</p>')))));
$devIDs = Config::inst()->get('Multisites', 'developer_identifiers');
if (is_array($devIDs)) {
if (!ArrayLib::is_associative($devIDs)) {
$devIDs = ArrayLib::valuekey($devIDs);
}
$fields->addFieldToTab('Root.Main', DropdownField::create('DevID', _t('Multisites.DeveloperIdentifier', 'Developer Identifier'), $devIDs));
}
if (Multisites::inst()->assetsSubfolderPerSite()) {
$fields->addFieldToTab('Root.Main', new TreeDropdownField('FolderID', _t('Multisites.ASSETSFOLDER', 'Assets Folder'), 'Folder'), 'SiteURLHeader');
}
if (!Permission::check('SITE_EDIT_CONFIGURATION')) {
foreach ($fields->dataFields() as $field) {
$fields->makeFieldReadonly($field);
}
}
$this->extend('updateSiteCMSFields', $fields);
return $fields;
}
示例5: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$fields->addFieldToTab("Root.Orders", GridField::create("OrderNotifications", "Order status notifications", $this->owner->OrderNotifications(), GridFieldConfig_RecordEditor::create()));
$fields->addFieldToTab("Root.Orders", HTMLEditorField::create("OrdersHeader", _t("Orders.QuoteInvoiceHeader", "Quote and Invoice Header")));
$fields->addFieldToTab("Root.Orders", HTMLEditorField::create("QuoteFooter"));
$fields->addFieldToTab("Root.Orders", HTMLEditorField::create("InvoiceFooter"));
}
示例6: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
// Add config sets
$fields->addFieldToTab('Root.Catalogue', UploadField::create('DefaultProductImage', _t("Catalogue.DefaultProductImage", 'Default product image')));
// Add config sets
$fields->addFieldToTab('Root.Catalogue', GridField::create('TaxRates', _t("Catalogue.TaxRates", "Tax Rates"), TaxRate::get(), GridFieldConfig::create()->addComponents(new GridFieldToolbarHeader(), new GridFieldAddNewButton('toolbar-header-right'), new GridFieldSortableHeader(), new GridFieldDataColumns(), new GridFieldPaginator(5), new GridFieldEditButton(), new GridFieldDeleteAction(), new GridFieldDetailForm())));
}
示例7: updateCMSFields
/**
* standard SS method
* @param Object - $fields (FieldList)
* @return Object - FieldList
*/
function updateCMSFields(FieldList $fields)
{
$additionalWhereForDefault = "";
$fields->removeByName("ExcludedFrom");
$fields->removeByName("AdditionalTax");
$tabName = "Root.Tax";
if ($this->owner instanceof ProductVariation) {
$fields->addFieldToTab($tabName, new LiteralField("SeeProductForAdditionalTax", _t("GSTTaxModifier.SEE_PARENT", "See parent Product for Additional Tax")));
} else {
//additional taxes
$additionalOptions = GSTTaxModifierOptions::get()->filter(array("DoesNotApplyToAllProducts" => 1));
if ($additionalOptions->count()) {
$additionalOptionsList = $additionalOptions->map()->toArray();
$fields->addFieldToTab($tabName, new CheckboxSetField("AdditionalTax", _t("GSTTaxMofidifier.ADDITIONAL_TAXES", "Additional taxes ..."), $additionalOptionsList));
}
}
if ($this->owner instanceof ProductVariation) {
$fields->addFieldToTab($tabName, new LiteralField("SeeProductForExcludedFrom", _t("GSTTaxModifier.SEE_PARRENT", "See parent product for excluded taxes")));
} else {
//excluded options
$excludedOptions = GSTTaxModifierOptions::get()->filter(array("DoesNotApplyToAllProducts" => 0));
if ($excludedOptions->count()) {
$excludedOptionsList = $excludedOptions->map()->toArray();
$fields->addFieldToTab($tabName, new CheckboxSetField("ExcludedFrom", _t("GSTTaxMofidifier.EXCLUDE_TAXES", "Taxes that do not apply ..."), $excludedOptionsList));
$additionalWhereForDefault = " \"GSTTaxModifierOptions\".\"ID\" NOT IN (" . implode(", ", $excludedOptions->map("ID", "ID")->toArray()) . ")";
}
}
//default options
$defaultOptions = GSTTaxModifierOptions::get()->filter(array("DoesNotApplyToAllProducts" => 0))->where($additionalWhereForDefault);
if ($defaultOptions->count()) {
$fields->addFieldToTab($tabName, new ReadonlyField("AlwaysApplies", "+ " . implode(", ", $defaultOptions->map()->toArray()) . "."));
}
}
示例8: getEditForm
public function getEditForm($id = null, $fields = null)
{
$tabs = new TabSet('Root', new Tab('Main'));
$fields = new FieldList($tabs);
$caches = array();
$all_caches = SimpleCache::$cache_configs;
foreach ($all_caches as $name => $cacheInfo) {
$cache = $this->getCache($name);
if ($cache) {
$stats = $cache->stats();
$fields->addFieldToTab('Root.Main', new HeaderField($name . 'header', $name));
$fields->addFieldToTab('Root.Main', new ReadonlyField($name . 'Hits', 'Hits', $stats->hits));
$fields->addFieldToTab('Root.Main', new ReadonlyField($name . 'Miss', 'Miss', $stats->misses));
$fields->addFieldToTab('Root.Main', new ReadonlyField($name . 'Count', 'Count', $stats->count));
$caches[$name] = $name;
}
}
if (count($caches)) {
$fields->addFieldToTab('Root.Clear', new CheckboxSetField('ToClear', 'Caches to clear', $caches));
}
$actions = new FieldList(new FormAction('clear', 'Clear'));
$form = new Form($this, 'EditForm', $fields, $actions);
$form->addExtraClass('cms-edit-form cms-panel-padded center ' . $this->BaseCSSClasses());
return $form;
}
示例9: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
if (Permission::check('ADMIN')) {
$fields->addFieldToTab("Root.PageBuilder", new LiteralField("Instructions", "\n\t\t\t\t\t<p class=\"helpText\">\n\t\t\t\t\t\tEnter your list of initial pages and their page types. If you do not include a page type, it will default to \"Page\".<br />\n\t\t\t\t\t\t<br />\n\t\t\t\t\t\tTo make a child page, begin the line with a symbol \"~\" for each level. For example, second level pages would look like this:<br />\n\t\t\t\t\t\t<br />\n\t\t\t\t\t\tAbout Us<br />~Our Services<br />~Our History\n\t\t\t\t\t\t<br />\n\t\t\t\t\t\t<br />\n\t\t\t\t\t\tTo set the page type, use a bar \"|\" between the page name and page type, like this:<br />\n\t\t\t\t\t\tHome|HomePage<br /><br />\n\t\t\t\t\t\tExisting pages at the same level will not be duplicated, if the page exists at the same level, it will not be changed, but children may be created\n\t\t\t\t\t</p>\n\t\t\t\t"));
$fields->addFieldToTab("Root.PageBuilder", new TextAreaField("PageStructure", "Page Structure"));
}
}
示例10: getCMSFields
function getCMSFields()
{
if ($this->ID != 0) {
$totalCount = $this->getTotalVotes();
} else {
$totalCount = 0;
}
$fields = new FieldList($rootTab = new TabSet("Root", new Tab("Main", new TextField('Title', 'Poll title (maximum 50 characters)', null, 50), new OptionsetField('MultiChoice', 'Single answer (radio buttons)/multi-choice answer (tick boxes)', array(0 => 'Single answer', 1 => 'Multi-choice answer')), new OptionsetField('IsActive', 'Poll state', array(1 => 'Active', 0 => 'Inactive')), $embargo = new DatetimeField('Embargo', 'Embargo'), $expiry = new DatetimeField('Expiry', 'Expiry'), new HTMLEditorField('Description', 'Description'))));
$embargo->getDateField()->setConfig('showcalendar', true);
$embargo->getTimeField()->setConfig('showdropdown', true);
$embargo->getDateField()->setConfig('dateformat', 'dd/MM/YYYY');
$embargo->getTimeField()->setConfig('timeformat', 'h:m a');
$expiry->getDateField()->setConfig('showcalendar', true);
$expiry->getTimeField()->setConfig('showdropdown', true);
$expiry->getDateField()->setConfig('dateformat', 'dd/MM/YYYY');
$expiry->getTimeField()->setConfig('timeformat', 'h:m a');
// Add the fields that depend on the poll being already saved and having an ID
if ($this->ID != 0) {
$config = GridFieldConfig::create();
$config->addComponent(new GridFieldToolbarHeader());
$config->addComponent(new GridFieldAddNewButton('toolbar-header-right'));
$config->addComponent(new GridFieldDataColumns());
$config->addComponent(new GridFieldEditButton());
$config->addComponent(new GridFieldDeleteAction());
$config->addComponent(new GridFieldDetailForm());
$config->addComponent(new GridFieldSortableHeader());
$pollChoicesTable = new GridField('Choices', 'Choices', $this->Choices(), $config);
$fields->addFieldToTab('Root.Data', $pollChoicesTable);
$fields->addFieldToTab('Root.Data', new ReadonlyField('Total', 'Total votes', $totalCount));
} else {
$fields->addFieldToTab('Root.Choices', new ReadOnlyField('ChoicesPlaceholder', 'Choices', 'You will be able to add options once you have saved the poll for the first time.'));
}
$this->extend('updateCMSFields', $fields);
return $fields;
}
示例11: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$fields->addFieldToTab('Root', Tab::create("GoogleAnalytics", _t('GoogleAnalyzer.TABTITLE', "Google Analytics")));
$fields->addFieldToTab("Root.GoogleAnalytics", TabSet::create("Stats", _t('GoogleAnalyzer.STATS', "Stats")));
$fields->addFieldToTab('Root.GoogleAnalytics.Stats', Tab::create("Performance", _t('GoogleAnalyzer.PERFORMANCE', "Performance")));
$fields->addFieldToTab("Root.GoogleAnalytics.Stats.Performance", new GooglePerformanceChart($this->owner));
}
示例12: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$fields->removeByName("IsSpam");
$fields->removeByName("URL");
$fields->addFieldToTab("Root.Main", new ReadonlyField("Email"), "Moderated");
$fields->addFieldToTab("Root.Main", new ReadonlyField("ParentTitle", "Blog Post"), "Name");
}
示例13: updateSettingsFields
public function updateSettingsFields(FieldList $fields)
{
$changeFreq = Singleton('Page')->dbObject('ChangeFreq')->enumValues();
$fields->addFieldToTab('Root.Settings', DropDownField::create('ChangeFreq', 'Change Frequency', $changeFreq));
$priority = Singleton('Page')->dbObject('Priority')->enumValues();
$fields->addFieldToTab('Root.Settings', DropDownField::create('Priority', 'Priority', $priority));
}
示例14: getCMSFields
public function getCMSFields()
{
$fields = new FieldList(new TabSet('Root'));
$fields->addFieldToTab('Root.Main', new TextField('Name', 'Name'));
$fields->addFieldToTab('Root.Main', new TextField('Alias', 'Alias (Unique reference)'));
return $fields;
}
示例15: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
if ($this->owner->ID) {
// Relation handler for Blocks
$SConfig = GridFieldConfig_RelationEditor::create(25);
$SConfig->addComponent(new GridFieldOrderableRows('SortOrder'));
$SConfig->addComponent(new GridFieldDeleteAction());
// If the copy button module is installed, add copy as option
if (class_exists('GridFieldCopyButton')) {
$SConfig->addComponent(new GridFieldCopyButton(), 'GridFieldDeleteAction');
}
$gridField = new GridField("Blocks", "Content blocks", $this->owner->Blocks(), $SConfig);
$classes = array_values(ClassInfo::subclassesFor($gridField->getModelClass()));
if (count($classes) > 1 && class_exists('GridFieldAddNewMultiClass')) {
$SConfig->removeComponentsByType('GridFieldAddNewButton');
$SConfig->addComponent(new GridFieldAddNewMultiClass());
}
if (self::$create_block_tab) {
$fields->addFieldToTab("Root.Blocks", $gridField);
} else {
// Downsize the content field
$fields->removeByName('Content');
$fields->addFieldToTab('Root.Main', HTMLEditorField::create('Content')->setRows(self::$contentarea_rows), 'Metadata');
$fields->addFieldToTab("Root.Main", $gridField, 'Metadata');
}
}
return $fields;
}