當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FieldSet::addFieldToTab方法代碼示例

本文整理匯總了PHP中FieldSet::addFieldToTab方法的典型用法代碼示例。如果您正苦於以下問題:PHP FieldSet::addFieldToTab方法的具體用法?PHP FieldSet::addFieldToTab怎麽用?PHP FieldSet::addFieldToTab使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在FieldSet的用法示例。


在下文中一共展示了FieldSet::addFieldToTab方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: updateCMSFields

 public function updateCMSFields(FieldSet $fields)
 {
     $service = singleton('WorkflowService');
     if ($effective = $service->getDefinitionFor($this->owner)) {
         $effectiveTitle = $effective->Title;
     } else {
         $effectiveTitle = _t('WorkflowApplicable.NONE', '(none)');
     }
     $allDefinitions = array(_t('WorkflowApplicable.INHERIT', 'Inherit from parent'));
     if ($definitions = $service->getDefinitions()) {
         $allDefinitions += $definitions->map();
     }
     $tab = $fields->fieldByName('Root') ? 'Root.Workflow' : 'BottomRoot.Workflow';
     $applyWorkflowField = null;
     $fields->addFieldToTab($tab, new HeaderField('AppliedWorkflowHeader', _t('WorkflowApplicable.APPLIEDWORKFLOW', 'Applied Workflow')));
     if (Permission::check('APPLY_WORKFLOW')) {
         $fields->addFieldToTab($tab, new DropdownField('WorkflowDefinitionID', _t('WorkflowApplicable.DEFINITION', 'Applied Workflow'), $allDefinitions));
     }
     $fields->addFieldToTab($tab, new ReadonlyField('EffectiveWorkflow', _t('WorkflowApplicable.EFFECTIVE_WORKFLOW', 'Effective Workflow'), $effectiveTitle));
     $fields->addFieldToTab($tab, new HeaderField('WorkflowLogHeader', _t('WorkflowApplicable.WORKFLOWLOG', 'Workflow Log')));
     $fields->addFieldToTab($tab, $logTable = new ComplexTableField($this->owner, 'WorkflowLog', 'WorkflowInstance', null, 'getActionsSummaryFields', sprintf('"TargetClass" = \'%s\' AND "TargetID" = %d', $this->owner->class, $this->owner->ID)));
     $logTable->setRelationAutoSetting(false);
     $logTable->setPermissions(array('show'));
     $logTable->setPopupSize(760, 420);
 }
開發者ID:rodneyway,項目名稱:advancedworkflow,代碼行數:25,代碼來源:WorkflowApplicable.php

示例2: updateCMSFields

 /**
  * standard SS method
  *
  */
 function updateCMSFields(FieldSet &$fields)
 {
     $fields->addFieldToTab('Root.Content', new Tab(ProductVariation::get_plural_name(), new HeaderField(ProductVariation::get_plural_name() . " for {$this->owner->Title}"), $this->owner->getVariationsTable(), new CreateEcommerceVariations_Field('VariationMaker', '', $this->owner->ID)));
     if ($this->owner->Variations() && $this->owner->Variations()->count()) {
         $fields->addFieldToTab('Root.Content.Main', new LabelField('variationspriceinstructions', 'Price - Because you have one or more variations, you can vary the price in the "' . ProductVariation::get_plural_name() . '" tab. You set the default price here.'), 'Price');
         $fields->addFieldToTab('Root.Content.Details', new LiteralField('UpdateVariationsPrices', "<p class=\"message good\">Click <a href=\"{$this->owner->Link('updatevariationpricefromproduct')}\">here</a> to update all the variations with the price above.</p>"), 'InternalItemID');
     }
 }
開發者ID:riddler7,項目名稱:silverstripe-product-variations,代碼行數:12,代碼來源:ProductWithVariationDecorator.php

示例3: updateCMSFields

 /**
  * Create {@link ComplexTableField} for managing {@link FlatFeeShippingRate}s.
  * 
  * @see DataObjectDecorator::updateCMSFields()
  */
 function updateCMSFields(FieldSet &$fields)
 {
     $fields->findOrMakeTabSet('Root.Shop.Shipping');
     $fields->addFieldToTab("Root.Shop.Shipping", new Tab('FlatFeeShipping'));
     $managerClass = class_exists('DataObjectManager') ? 'DataObjectManager' : 'ComplexTableField';
     $flatFeeManager = new $managerClass($this->owner, 'FlatFeeShippingRates', 'FlatFeeShippingRate', array('Title' => 'Label', 'Description' => 'Description', 'Country.Title' => 'Country', 'SummaryOfAmount' => 'Amount'), 'getCMSFields_forPopup');
     $fields->addFieldToTab("Root.Shop.Shipping.FlatFeeShipping", $flatFeeManager);
 }
開發者ID:helpfulrobot,項目名稱:swipestripe-swipestripe,代碼行數:13,代碼來源:FlatFeeShippingConfigDecorator.php

示例4: updateCMSFields

 public function updateCMSFields(FieldSet &$fields)
 {
     $tab = "Root.Jobamatic";
     // Create a new tab to hold our jobamatic settings so we don't clutter up the other tabs.
     $fields->findOrMakeTab($tab, "Jobamatic");
     $fields->addFieldToTab($tab, new TextField("jobamatic_publisher_id", "Publisher ID"));
     $fields->addFieldToTab($tab, new TextField("jobamatic_domain", "Domain"));
 }
開發者ID:r0nn1ef,項目名稱:SilverStripe-Jobamatic-Module,代碼行數:8,代碼來源:JobamaticSiteConfig.php

示例5: updateCMSFields

 /**
  * Create {@link ComplexTableField} for managing {@link FlatFeeTaxRate}s.
  * 
  * @see DataObjectDecorator::updateCMSFields()
  */
 function updateCMSFields(FieldSet &$fields)
 {
     //$fields->addFieldToTab("Root", new TabSet('Shop'));
     $fields->addFieldToTab("Root.Shop", new TabSet('Tax'));
     $fields->addFieldToTab("Root.Shop.Tax", new Tab('FlatFeeTax'));
     $managerClass = class_exists('DataObjectManager') ? 'DataObjectManager' : 'ComplexTableField';
     $flatFeeManager = new $managerClass($this->owner, 'FlatFeeTaxRates', 'FlatFeeTaxRate', array('Title' => 'Label', 'Description' => 'Description', 'Country.Title' => 'Country', 'SummaryOfRate' => 'Rate'), 'getCMSFields_forPopup');
     $fields->addFieldToTab("Root.Shop.Tax.FlatFeeTax", $flatFeeManager);
 }
開發者ID:helpfulrobot,項目名稱:swipestripe-swipestripe,代碼行數:14,代碼來源:FlatFeeTaxConfigDecorator.php

示例6: FieldSet

 function getCMSFields_forPopup()
 {
     $fields = new FieldSet(new TabSet('Root'));
     //Name
     $fields->addFieldToTab("Root.Name", new TextField('VideoName', 'Name'));
     //Video
     $fields->addFieldToTab("Root.Video", new TextField('URL', 'URL Code'));
     return $fields;
 }
開發者ID:helpfulrobot,項目名稱:helenclarko-youtubevideoplaylist,代碼行數:9,代碼來源:Video.php

示例7: updateCMSFields

 function updateCMSFields(FieldSet &$fields)
 {
     //$fields->addFieldToTab('Root.RewardPoints', new NumericField('PointsPrice', 'The number of reward points it costs to purchase this product as a reward. Only products that have a non-zero value will be available as rewards.'));
     if ($this instanceof SiteTree) {
         $fields->addFieldToTab('Root.Content.RewardPoints', new NumericField('PointsValue', 'The number of rewards points received when this product is purchased. This value is optional, the product reward points value will be calculated from the product price if this value is zero.'));
     } else {
         $fields->addFieldToTab('Root.RewardPoints', new NumericField('PointsValue', 'The number of rewards points received when this product is purchased. This value is optional, the product reward points value will be calculated from the product price this value is zero.'));
     }
 }
開發者ID:helpfulrobot,項目名稱:sunnysideup-ecommerce-rewards,代碼行數:9,代碼來源:EcommerceRewardsBuyableDecorator.php

示例8: updateDateTimeCMSFields

 public function updateDateTimeCMSFields(FieldSet $fields)
 {
     if (!$this->owner->isInDB()) {
         $fields->addFieldToTab('Root.Resources', new LiteralField('BookResourcesNote', '<p>You can book resources after you save for the first time.</p>'));
         return;
     }
     $fields->addFieldToTab('Root.Resources', $res = new ManyManyPickerField($this->owner, 'Resources', 'Booked Resources For This Event', array('ExtraFields' => 'getCmsExtraFields', 'ShowPickedInSearch' => false, 'PopupHeight' => 350)));
     $res->getSearchField()->setOption('FilterCallback', array($this->owner, 'filterEventResource'));
 }
開發者ID:textagroup,項目名稱:silverstripe-eventresources,代碼行數:9,代碼來源:CalendarDateTimeResourcesExtension.php

示例9: updateCMSFields

 public function updateCMSFields(FieldSet $fields) {
 	$fields->addFieldToTab("Root.CongressAPI", new LiteralField("Instructions", "<p>The Congress API uses the Sunlight Congress API, and requires an API key.
 	You can register to get an API key here: <a href='http://services.sunlightlabs.com/accounts/register/' target='_blank'>http://services.sunlightlabs.com/accounts/register/</a>"));
     $fields->addFieldToTab("Root.CongressAPI", new TextField("SLApiKey", "Sunlight API Key"));
     
     $fields->addFieldToTab("Root.CongressAPI", new LiteralField("Instructions", "<p>The Congress API uses the IPInfoDB's API for gathering location
     info from IP address, and it requires an API key as well.
 	You can register to get an API key here: <a href='http://www.ipinfodb.com/register.php' target='_blank'>http://www.ipinfodb.com/register.php</a>"));
     $fields->addFieldToTab("Root.CongressAPI", new TextField("IPInfoKey", "IPInfoDB API Key"));
 }
開發者ID:notioncollective,項目名稱:silverstripe-congressapi,代碼行數:10,代碼來源:SLSiteConfig.php

示例10: updateCMSFields

 /**
  * Add UrlParent SiteTree Dropdown to Behaviour Tab
  *
  * @param FieldSet $fields
  */
 public function updateCMSFields(FieldSet &$fields)
 {
     //$baseURLField = $fields->fieldByName('BaseUrlLabel');
     $link = $this->Link();
     $link = substr($link, 1);
     $link = str_replace($this->owner->URLSegment . '/', '', $link);
     $baseUrlField = new LabelField('BaseUrlLabel', $link);
     $fields->addFieldToTab('Root.Content.Metadata', $baseUrlField, 'URLSegment');
     $fields->addFieldToTab('Root.Behaviour', new TreeDropdownField("UrlParentID", 'URL Parent', 'SiteTree'));
 }
開發者ID:jamespaulmuir,項目名稱:nestedurls,代碼行數:15,代碼來源:NestedUrlPageExtension.php

示例11: updateCMSFields

 /**
  * standard SS method
  *
  */
 function updateCMSFields(FieldSet &$fields)
 {
     if ($brands = Dataobject::get("Brand")) {
         $fields->removeFieldFromTab("Root.Content.Main", "Model");
         $fields->addFieldToTab('Root.Content.Main', new DropdownField('BrandID', 'Please choose an brand', $brands->map("ID", "Title", "Please Select")), "FeaturedProduct");
     }
 }
開發者ID:nimeso,項目名稱:shop-brands,代碼行數:11,代碼來源:ProductBrandDecorator.php

示例12: updateCMSFields

 /**
  * standard SS method
  *
  */
 function updateCMSFields(FieldSet &$fields)
 {
     // is it a product or variation
     if ($this->owner instanceof SiteTree) {
         if (!$this->owner->Variations()->exists()) {
             $tabName = "Root.Content.Main";
             $fieldName = "Weight";
             $fields->addFieldToTab($tabName, new NumericField('SpecialPrice', 'Special Price (0.00 will be ignored)', '', 12), $fieldName);
             $fields->addFieldToTab($tabName, new NumericField('Discount', 'Percentage Discount', '', 2), $fieldName);
         }
     } else {
         // it's a variation and hopefully has fields
         $fields->insertAfter(new NumericField('SpecialPrice', 'Special Price (0.00 will be ignored)', '', 12), "Price");
         $fields->insertAfter(new NumericField('Discount', 'Percentage Discount', '', 2), "SpecialPrice");
     }
 }
開發者ID:nimeso,項目名稱:shop-special-price,代碼行數:20,代碼來源:ProductSpecialPriceDecorator.php

示例13: updateCMSFields

 function updateCMSFields(FieldSet &$fields)
 {
     $bt = defined('DB::USE_ANSI_SQL') ? "\"" : "`";
     if (DataObject::get_one("FormFieldExplanation", "{$bt}ParentID{$bt} = " . $this->owner->ID)) {
         $fields->addFieldToTab("Root.Content.FormExplanations", $this->getFormFieldExplanationHasManyTable());
     }
     return $fields;
 }
開發者ID:helpfulrobot,項目名稱:sunnysideup-formfieldexplanations,代碼行數:8,代碼來源:FormFieldExplanationDecorator.php

示例14: updateCMSFields

    /**
     * Adding fields for shop settings such as email, license key.
     * 
     * @see DataObjectDecorator::updateCMSFields()
     */
    function updateCMSFields(FieldSet &$fields)
    {
        $fields->findOrMakeTabSet('Root.Shop');
        //License key
        $fields->addFieldToTab("Root.Shop", new Tab('LicenseKey'));
        $licenseKeyField = new TextField('LicenseKey', _t('ShopSettings.LICENSEKEY', 'License Key'), self::$license_key);
        $fields->addFieldToTab('Root.Shop.LicenseKey', $licenseKeyField->performReadonlyTransformation());
        //TODO include the license here in a text area field and some info about setting the license key perhaps
        //Shop emails
        $fields->addFieldToTab("Root.Shop", new TabSet('Emails'));
        $fields->addFieldToTab("Root.Shop.Emails", new Tab('Receipt'), new Tab('Notification'));
        $fields->addFieldToTab('Root.Shop.Emails.Receipt', new TextField('ReceiptFrom', _t('ShopSettings.FROM', 'From')));
        $receiptTo = new TextField('ReceiptTo', _t('ShopSettings.TO', 'To'));
        $receiptTo->setValue(_t('ShopSettings.RECEIPT_TO', 'Sent to customer'));
        $receiptTo = $receiptTo->performReadonlyTransformation();
        $fields->addFieldToTab('Root.Shop.Emails.Receipt', $receiptTo);
        $fields->addFieldToTab('Root.Shop.Emails.Receipt', new TextField('ReceiptSubject', _t('ShopSettings.SUBJECT_LINE', 'Subject line')));
        $fields->addFieldToTab('Root.Shop.Emails.Receipt', new TextareaField('ReceiptBody', _t('ShopSettings.MESSAGE', 'Message (order details are included in the email)'), 8));
        $fields->addFieldToTab('Root.Shop.Emails.Receipt', new TextareaField('EmailSignature', _t('ShopSettings.SIGNATURE', 'Signature'), 8));
        $notificationFrom = new TextField('NotificationFrom', _t('ShopSettings.FROM', 'From'));
        $notificationFrom->setValue(_t('ShopSettings.NOTIFICATION_FROM', 'Customer email address'));
        $notificationFrom = $notificationFrom->performReadonlyTransformation();
        $fields->addFieldToTab('Root.Shop.Emails.Notification', $notificationFrom);
        $fields->addFieldToTab('Root.Shop.Emails.Notification', new TextField('NotificationTo', _t('ShopSettings.TO', 'To')));
        $fields->addFieldToTab('Root.Shop.Emails.Notification', new TextField('NotificationSubject', _t('ShopSettings.SUBJECT_LINE', 'Subject line')));
        $fields->addFieldToTab('Root.Shop.Emails.Notification', new TextareaField('NotificationBody', _t('ShopSettings.MESSAGE', 'Message (order details are included in the email)'), 10));
        //Shipping
        $fields->findOrMakeTabSet('Root.Shop.Shipping');
        $fields->addFieldToTab("Root.Shop.Shipping", new Tab('Countries'));
        $fields->addFieldToTab("Root.Shop.Shipping", new Tab('Regions'));
        $managerClass = class_exists('DataObjectManager') ? 'DataObjectManager' : 'ComplexTableField';
        $manager = new $managerClass($this->owner, 'ShippingCountries', 'Country_Shipping');
        $fields->addFieldToTab("Root.Shop.Shipping.Countries", $manager);
        $managerClass = class_exists('DataObjectManager') ? 'DataObjectManager' : 'ComplexTableField';
        $manager = new $managerClass($this->owner, 'ShippingRegions', 'Region_Shipping');
        $fields->addFieldToTab("Root.Shop.Shipping.Regions", $manager);
        if (file_exists(BASE_PATH . '/swipestripe') && ShopSettings::get_license_key() == null) {
            $warning = _t('ShopSettings.LICENCE_WARNING', '
        Warning: You have SwipeStripe installed without a license key. 
        Please <a href="http://swipestripe.com" target="_blank">purchase a license key here</a> before this site goes live.
			');
            $fields->addFieldToTab("Root.Main", new LiteralField("SwipeStripeLicenseWarning", '<p class="message warning">' . $warning . '</p>'), "Title");
        }
    }
開發者ID:helpfulrobot,項目名稱:swipestripe-swipestripe,代碼行數:49,代碼來源:ShopSettings.php

示例15: getCMSFields

 /**
  * Caution: Only call on instances, not through a singleton.
  *
  * @return FieldSet
  */
 public function getCMSFields()
 {
     $fields = new FieldSet(new TabSet("Root", new Tab(_t('SecurityAdmin.MEMBERS', 'Members'), new TextField("Title", $this->fieldLabel('Title')), $memberList = new MemberTableField($this, "Members", $this, null, false)), $permissionsTab = new Tab(_t('SecurityAdmin.PERMISSIONS', 'Permissions'), new PermissionCheckboxSetField('Permissions', false, 'Permission', 'GroupID', $this)), new Tab(_t('Security.IPADDRESSES', 'IP Addresses'), new LiteralField("", _t('SecurityAdmin.IPADDRESSESHELP', "<p>You can restrict this group to a particular \n\t\t\t\t\t\tIP address range (one range per line). <br />Ranges can be in any of the following forms: <br />\n\t\t\t\t\t\t203.96.152.12<br />\n\t\t\t\t\t\t203.96.152/24<br />\n\t\t\t\t\t\t203.96/16<br />\n\t\t\t\t\t\t203/8<br /><br />If you enter one or more IP address ranges in this box, then members will only get\n\t\t\t\t\t\tthe rights of being in this group if they log on from one of the valid IP addresses.  It won't prevent\n\t\t\t\t\t\tpeople from logging in.  This is because the same user might have to log in to access parts of the\n\t\t\t\t\t\tsystem without IP address restrictions.")), new TextareaField("IPRestrictions", "IP Ranges", 10))));
     // Only add a dropdown for HTML editor configurations if more than one is available.
     // Otherwise Member->getHtmlEditorConfigForCMS() will default to the 'cms' configuration.
     $editorConfigMap = HtmlEditorConfig::get_available_configs_map();
     if (count($editorConfigMap) > 1) {
         $fields->addFieldToTab('Root.Permissions', new DropdownField('HtmlEditorConfig', 'HTML Editor Configuration', $editorConfigMap), 'Permissions');
     }
     if (!Permission::check('EDIT_PERMISSIONS')) {
         $fields->removeFieldFromTab('Root', 'Permissions');
         $fields->removeFieldFromTab('Root', 'IP Addresses');
     }
     // Only show the "Roles" tab if permissions are granted to edit them,
     // and at least one role exists
     if (Permission::check('APPLY_ROLES') && DataObject::get('PermissionRole')) {
         $fields->findOrMakeTab('Root.Roles', _t('SecurityAdmin.ROLES', 'Roles'));
         $fields->addFieldToTab('Root.Roles', new LiteralField("", "<p>" . _t('SecurityAdmin.ROLESDESCRIPTION', "This section allows you to add roles to this group. Roles are logical groupings of permissions, which can be editied in the Roles tab") . "</p>"));
         // Add roles (and disable all checkboxes for inherited roles)
         $allRoles = Permission::check('ADMIN') ? DataObject::get('PermissionRole') : DataObject::get('PermissionRole', 'OnlyAdminCanApply = 0');
         $groupRoles = $this->Roles();
         $inheritedRoles = new DataObjectSet();
         $ancestors = $this->getAncestors();
         foreach ($ancestors as $ancestor) {
             $ancestorRoles = $ancestor->Roles();
             if ($ancestorRoles) {
                 $inheritedRoles->merge($ancestorRoles);
             }
         }
         $fields->findOrMakeTab('Root.Roles', 'Root.' . _t('SecurityAdmin.ROLES', 'Roles'));
         $fields->addFieldToTab('Root.Roles', $rolesField = new CheckboxSetField('Roles', 'Roles', $allRoles));
         $rolesField->setDefaultItems($inheritedRoles->column('ID'));
         $rolesField->setDisabledItems($inheritedRoles->column('ID'));
     }
     $memberList->setController($this);
     $memberList->setPermissions(array('edit', 'delete', 'export', 'add', 'inlineadd'));
     $memberList->setParentClass('Group');
     $memberList->setPopupCaption(_t('SecurityAdmin.VIEWUSER', 'View User'));
     $memberList->setRelationAutoSetting(false);
     $fields->push($idField = new HiddenField("ID"));
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
開發者ID:Raiser,項目名稱:Praktikum,代碼行數:48,代碼來源:Group.php


注:本文中的FieldSet::addFieldToTab方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。