当前位置: 首页>>代码示例>>PHP>>正文


PHP DataExtension::updateCMSFields方法代码示例

本文整理汇总了PHP中DataExtension::updateCMSFields方法的典型用法代码示例。如果您正苦于以下问题:PHP DataExtension::updateCMSFields方法的具体用法?PHP DataExtension::updateCMSFields怎么用?PHP DataExtension::updateCMSFields使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataExtension的用法示例。


在下文中一共展示了DataExtension::updateCMSFields方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: updateCMSFields

 /**
  * Alter the CMS Fields in order to automatically present the
  * correct ones based on current language.
  * @inheritdoc
  */
 public function updateCMSFields(FieldList $fields)
 {
     parent::updateCMSFields($fields);
     if (!isset(self::$collectorCache[$this->owner->class])) {
         return;
     }
     // remove all localized fields from the list (generated through scaffolding)
     foreach (self::$collectorCache[$this->owner->class] as $translatableField => $type) {
         $fields->removeByName($translatableField);
     }
     // check if we're in a translation
     if (Translatable::default_locale() != Translatable::get_current_locale()) {
         /** @var TranslatableFormFieldTransformation $transformation */
         $transformation = TranslatableFormFieldTransformation::create($this->owner);
         // iterate through all localized fields
         foreach (self::$collectorCache[$this->owner->class] as $translatableField => $type) {
             if (strpos($translatableField, Translatable::get_current_locale())) {
                 $basename = $this->getBasename($translatableField);
                 if ($field = $this->getLocalizedFormField($basename, Translatable::default_locale())) {
                     $fields->replaceField($basename, $transformation->transformFormField($field));
                 }
             }
         }
     }
 }
开发者ID:bummzack,项目名称:translatable-dataobject,代码行数:30,代码来源:TranslatableDataObject.php

示例2: updateCMSFields

 public function updateCMSFields(\FieldList $fields)
 {
     if (!Permission::check('ADMIN')) {
         Requirements::css(HIDE_HISTORY_BASE . '/css/hide-history.css');
     }
     parent::updateCMSFields($fields);
 }
开发者ID:helpfulrobot,项目名称:zirak-hide-history,代码行数:7,代码来源:HideHistory.php

示例3: updateCMSFields

 public function updateCMSFields(\FieldList $fields)
 {
     parent::updateCMSFields($fields);
     // Loop over each WidgetArea
     $has_one = $this->owner->has_one();
     foreach ($has_one as $name => $class) {
         if ($class == 'WidgetArea') {
             /*
              * Widget gridfield 
              */
             $adder = new GridFieldAddNewMultiClass();
             // Allowed classes
             $allowed = $this->owner->config()->get("allowed_widgets");
             if (is_array($allowed)) {
                 // Filter classes for creating new ones
                 $adder->setClasses($allowed);
             }
             $config = GridFieldConfig_RelationEditor::create()->removeComponentsByType("GridFieldAddNewButton")->addComponent($adder)->addComponent(new GridFieldOrderableRows('WidgetAreaSort'));
             // It's not possible to add existing through GridFieldAddExistingSearchButton since
             // it display by default $Title in its template and we want to search by $WidgetName
             $config->getComponentByType('GridFieldAddExistingAutocompleter')->setSearchFields(array('WidgetName'))->setResultsFormat('$WidgetName');
             // WidgetArea's Widget GridField
             $gridField = GridField::create($name, $name, $this->owner->{$name}()->SortedWidgets(false))->setConfig($config);
             $fields->addFieldToTab("Root.{$name}", $gridField);
         }
     }
 }
开发者ID:helpfulrobot,项目名称:zirak-widget-pages-extension,代码行数:27,代码来源:WidgetDataObject.php

示例4: updateCMSFields

 /**
  * Remove the administrators group from the possible parent group
  * 
  * @todo this check should be done in core code, since the dropdown can be simply 
  *				crafted for injecting administrators group ID
  * @param \FieldList $fields
  */
 public function updateCMSFields(\FieldList $fields)
 {
     parent::updateCMSFields($fields);
     /* @var $parentID DropdownField */
     $parentID = $fields->fieldByName('Root.Members.ParentID');
     $parentID->setDisabledItems(array(DataObject::get_one('Group', "Code='administrators'")->ID));
 }
开发者ID:helpfulrobot,项目名称:zirak-member-user-management,代码行数:14,代码来源:ZkMemberGroup.php

示例5: updateCMSFields

 public function updateCMSFields(\FieldList $fields)
 {
     parent::updateCMSFields($fields);
     $stores = $this->contentService->getStoreTypes();
     if (count($stores)) {
         $default = array('' => 'Inherit');
         $stores = array_merge($default, array_combine(array_keys($stores), array_keys($stores)));
         $fields->push(new DropdownField('StoreInCDN', 'Store content in CDN', $stores));
     }
 }
开发者ID:helpfulrobot,项目名称:silverstripe-cdncontent,代码行数:10,代码来源:CDNFolder.php

示例6: updateCMSFields

 public function updateCMSFields(\FieldList $fields)
 {
     parent::updateCMSFields($fields);
     $fields->removeByName('Sort');
     $fields->removeByName('ParentID');
     $field = new TextField('WidgetLabel', 'Widget Label');
     $fields->add($field);
     $field = new TextField('WidgetName', 'Widget Name');
     $fields->add($field);
 }
开发者ID:helpfulrobot,项目名称:zirak-widget-pages-extension,代码行数:10,代码来源:WidgetPageWidget.php

示例7: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     parent::updateCMSFields($fields);
     $fields->findOrMakeTab('Root.Advertisements', _t('UniadsObject.PLURALNAME', 'Advertisements'));
     $fields->addFieldToTab('Root.Advertisements', new CheckboxField('InheritSettings', _t('UniadsObject.InheritSettings', 'Inherit parent settings')));
     if (!$this->owner->InheritSettings) {
         $conf = GridFieldConfig_RelationEditor::create();
         $conf->getComponentByType('GridFieldAddExistingAutocompleter')->setSearchFields(array('Title'));
         $grid = new GridField("Advertisements", _t('UniadsObject.PLURALNAME', 'Advertisements'), $this->owner->Ads(), $conf);
         $fields->addFieldToTab("Root.Advertisements", $grid);
         $fields->addFieldToTab('Root.Advertisements', new DropdownField('UseCampaignID', _t('UniadsObject.UseCampaign', 'Use Campaign'), $this->getListboxOptions('UniadsCampaign')));
     }
 }
开发者ID:helpfulrobot,项目名称:unisolutions-silverstripe-uniads,代码行数:13,代码来源:UniadsExtension.php

示例8: updateCMSFields

 public function updateCMSFields(\FieldList $fields)
 {
     parent::updateCMSFields($fields);
     $token = $this->userToken();
     if (!$token) {
         $token = "This user token can no longer be displayed - if you do not know this value, regenerate tokens by selecting Regenerate below";
     } else {
         $token = $this->owner->ID . ':' . $token;
     }
     $readOnly = ReadonlyField::create('DisplayToken', 'Token', $token);
     $fields->addFieldToTab('Root.Main', $readOnly, 'AuthPrivateKey');
     $field = $fields->dataFieldByName('AuthPrivateKey');
     $fields->replaceField('AuthPrivateKey', $field->performReadonlyTransformation());
     $fields->removeByName('Token');
 }
开发者ID:helpfulrobot,项目名称:silverstripe-webservices,代码行数:15,代码来源:TokenAccessible.php

示例9: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     if ($this->owner->ShowTimeline) {
         // Create add button
         $add_button = new GridFieldAddNewButton('toolbar-header-left');
         $add_button->setButtonName('Add Event');
         // Add timeline editor
         $grid_config = GridFieldConfig_RecordEditor::create()->removeComponentsByType('GridFieldAddNewButton')->removeComponentsByType('GridFieldFilterHeader')->addComponent(new GridFieldOrderableRows('Sort'))->addComponent($add_button);
         $timeline_table = GridField::create('Events', false, $this->owner->Events(), $grid_config);
         $fields->addFieldToTab('Root.Timeline', $timeline_table);
     } else {
         $fields->removeByName('Events');
     }
     $fields->removeByName('ShowTimeline');
     parent::updateCMSFields($fields);
 }
开发者ID:rath3r,项目名称:silverstripe-timeline,代码行数:16,代码来源:TimelinePage.php

示例10: updateCMSFields

 public function updateCMSFields(\FieldList $fields)
 {
     parent::updateCMSFields($fields);
     $stores = $this->contentService->getStoreTypes();
     if (count($stores)) {
         if ($this->owner->ID) {
             $default = array('' => 'Inherit');
             $stores = array_merge($default, array_combine(array_keys($stores), array_keys($stores)));
             $fields->push(new DropdownField('StoreInCDN', 'Store content in CDN', $stores));
         } else {
             if ($default = $this->contentService->getDefaultStore()) {
                 $fields->push(LiteralField::create("DefaultStoreNote", sprintf(_t('CDNFolder.DEFAULT_NOTE', '<h3>Storing in %s</h3>'), $default)));
             }
         }
     }
 }
开发者ID:stephenmcm,项目名称:silverstripe-cdncontent,代码行数:16,代码来源:CDNFolder.php

示例11: updateCMSFields

 function updateCMSFields(FieldList $fields)
 {
     parent::updateCMSFields($fields);
     if (ProductQuestion::get()->count()) {
         $productQuestionsDefault = $this->owner->Product()->ApplicableProductQuestions();
         $productQuestionsDefaultArray = array(0 => 0);
         if ($productQuestionsDefault && $productQuestionsDefault->count()) {
             $productQuestionsDefaultArray = $productQuestionsDefault->map("ID", "FullName")->toArray();
             $fields->addFieldToTab("Root.Questions", new CheckboxSetField("IgnoreProductQuestions", _t("ProductQuestions.IGNORE_QUESTIONS", "Ignore Questions for this variation"), $productQuestionsDefaultArray));
         }
         $productQuestionsAdditional = ProductQuestion::get()->exclude(array("ID" => array_flip($productQuestionsDefaultArray)));
         if ($productQuestionsAdditional->count()) {
             $productQuestionsAdditionalArray = $productQuestionsAdditional->map("ID", "FullName")->toArray();
             $fields->addFieldToTab("Root.Questions", new CheckboxSetField("AdditionalProductQuestions", _t("ProductQuestions.ADDITIONAL_QUESTIONS", "Additional Questions for this variation"), $productQuestionsAdditionalArray));
         }
     }
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-ecommerce-product-questions,代码行数:17,代码来源:ProductQuestion_ProductVariationExtension.php

示例12: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     if ($this->owner->ShowCarousel) {
         // Create add button
         $add_button = new GridFieldAddNewButton('toolbar-header-left');
         $add_button->setButtonName('Add Slide');
         // Add carousel editor
         $grid_config = GridFieldConfig_RecordEditor::create()->removeComponentsByType('GridFieldAddNewButton')->removeComponentsByType('GridFieldFilterHeader')->addComponent(new GridFieldOrderableRows('Sort'))->addComponent($add_button);
         $carousel_table = GridField::create('Slides', false, $this->owner->Slides(), $grid_config);
         $fields->addFieldToTab('Root.Carousel', $carousel_table);
     } else {
         $fields->removeByName('Slides');
     }
     $fields->removeByName('ShowCarousel');
     $fields->removeByName('CarouselWidth');
     $fields->removeByName('CarouselHeight');
     parent::updateCMSFields($fields);
 }
开发者ID:i-lateral,项目名称:silverstripe-carousel,代码行数:18,代码来源:CarouselPage.php

示例13: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     if ($this->owner->ShowOrbit) {
         // Create add button
         $add_button = new GridFieldAddNewButton('toolbar-header-left');
         $add_button->setButtonName('Add Slide');
         // Add Orbit editor
         $grid_config = GridFieldConfig_RecordEditor::create()->removeComponentsByType('GridFieldAddNewButton')->removeComponentsByType('GridFieldFilterHeader')->addComponent($add_button);
         $orbit_table = GridField::create('Slides', false, $this->owner->Slides()->sort('Sort DESC'), $grid_config);
         $fields->addFieldToTab('Root.Orbit', $orbit_table);
     } else {
         $fields->removeByName('Slides');
     }
     $fields->removeByName('ShowOrbit');
     $fields->removeByName('OrbitWidth');
     $fields->removeByName('OrbitHeight');
     parent::updateCMSFields($fields);
 }
开发者ID:helpfulrobot,项目名称:leancode-silverstripe-foundation-orbit,代码行数:18,代码来源:OrbitPage.php

示例14: updateCMSFields

 public function updateCMSFields(\FieldList $fields)
 {
     parent::updateCMSFields($fields);
     $field = new DateField('FromDate');
     $field->setConfig('showcalendar', true);
     $field->setConfig('dateformat', 'dd/MM/YYYY');
     $field->setTitle(_t("BlogEntry.FROMDT", "Date"));
     if ($this->owner->Created == $this->owner->LastEdited) {
         // In caso di nuovo post, setto il campo FromDate ad oggi
         $now = Zend_Date::now();
         $this->owner->FromDate = $now->toString('d/M/Y');
     }
     $fields->addFieldToTab('Root.PublishedPeriod', $field);
     $field = new DateField('ToDate');
     $field->setConfig('showcalendar', true);
     $field->setConfig('dateformat', 'dd/MM/YYYY');
     $field->setTitle(_t("BlogEntry.TODT", "Date"));
     $fields->addFieldToTab('Root.PublishedPeriod', $field);
 }
开发者ID:helpfulrobot,项目名称:zirak-blog-post-publication-period,代码行数:19,代码来源:AdminPublicationPostDate.php

示例15: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     parent::updateCMSFields($fields);
     $fields->removeByName('Images');
     $name = Config::inst()->get('SimpleGalleryExtension', 'gallery_name');
     if ($this->owner->ID > 0) {
         $folder = Config::inst()->get('SimpleGalleryExtension', 'folder_path');
         if (strlen($folder) == 0) {
             $folder = 'simplegallery';
         }
         $gridFieldConfig = GridFieldConfig_RecordEditor::create();
         $bu = new GridFieldBulkImageUpload('Image', array('Title'));
         $bu->setConfig('folderName', $folder);
         $gridFieldConfig->addComponent($bu);
         $gridFieldSortableRows = new GridFieldSortableRows('SortOrder');
         $gridFieldConfig->addComponent($gridFieldSortableRows->setAppendToTop(true));
         $gridfield = new GridField("Gallery", $name, $this->SortedImages(true), $gridFieldConfig);
         $fields->addFieldToTab('Root.' . $name, $gridfield);
     }
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:zirak-simple-gallery,代码行数:21,代码来源:SimpleGalleryExtension.php


注:本文中的DataExtension::updateCMSFields方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。