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


PHP TreeDropdownField::setDescription方法代碼示例

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


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

示例1: getCMSFieldsForProductSliderWidget

 /**
  * Returns the input fields for this widget.
  * 
  * @param Widget $widget       Widget to initialize
  * @param array  $fetchMethods Optional list of product fetch methods
  * 
  * @return FieldList
  * 
  * @author Sebastian Diel <sdiel@pixeltricks.de>
  * @since 13.03.2014
  */
 public static function getCMSFieldsForProductSliderWidget(Widget $widget, $fetchMethods = array())
 {
     if (empty($fetchMethods)) {
         $fetchMethods = array('random' => $widget->fieldLabel('fetchMethodRandom'), 'sortOrderAsc' => $widget->fieldLabel('fetchMethodSortOrderAsc'), 'sortOrderDesc' => $widget->fieldLabel('fetchMethodSortOrderDesc'));
     }
     $fields = SilvercartDataObject::getCMSFields($widget, 'ExtraCssClasses', false);
     $productGroupDropdown = new TreeDropdownField('SilvercartProductGroupPageID', $widget->fieldLabel('SilvercartProductGroupPage'), 'SiteTree');
     $productGroupDropdown->setTreeBaseID(SilvercartTools::PageByIdentifierCode('SilvercartProductGroupHolder')->ID);
     $toggleFields = array($fields->dataFieldByName('numberOfProductsToShow'), $fields->dataFieldByName('numberOfProductsToFetch'), $fields->dataFieldByName('fetchMethod'), SilvercartGroupViewHandler::getGroupViewDropdownField('GroupView', $widget->fieldLabel('GroupView'), $widget->GroupView));
     $fields->dataFieldByName('fetchMethod')->setSource($fetchMethods);
     $fields->dataFieldByName('numberOfProductsToShow')->setDescription($widget->fieldLabel('numberOfProductsToShowInfo'));
     $fields->dataFieldByName('isContentView')->setDescription($widget->fieldLabel('isContentViewInfo'));
     if (is_object($fields->dataFieldByName('useSelectionMethod'))) {
         $fields->dataFieldByName('useSelectionMethod')->setSource(array('productGroup' => $widget->fieldLabel('SelectionMethodProductGroup'), 'products' => $widget->fieldLabel('SelectionMethodProducts')));
         $toggleFields[] = $fields->dataFieldByName('useSelectionMethod');
         $productGroupDropdown->setDescription($widget->fieldLabel('SilvercartProductGroupPageDescription'));
     }
     $toggleFields[] = $productGroupDropdown;
     $productDataToggle = ToggleCompositeField::create('ProductDataToggle', $widget->fieldLabel('ProductDataToggle'), $toggleFields)->setHeadingLevel(4);
     $productRelationToggle = ToggleCompositeField::create('ProductRelationToggle', $widget->fieldLabel('ProductRelationToggle'), array($fields->dataFieldByName('SilvercartProducts')))->setHeadingLevel(4);
     $fields->removeByName('numberOfProductsToShow');
     $fields->removeByName('numberOfProductsToFetch');
     $fields->removeByName('fetchMethod');
     $fields->removeByName('useSelectionMethod');
     $fields->removeByName('SilvercartProducts');
     $fields->addFieldToTab("Root.Main", $productDataToggle);
     $fields->addFieldToTab("Root.Main", $productRelationToggle);
     $widget->getCMSFieldsSliderTab($fields);
     //$widget->getCMSFieldsRoundaboutTab($fields);
     return $fields;
 }
開發者ID:silvercart,項目名稱:silvercart,代碼行數:42,代碼來源:SilvercartWidgetTools.php

示例2: getCMSFields

 /**
  * Add fields to manage FAQs.
  *
  * @return $fields
  */
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $this->extend('beforeGetCMSFields', $fields);
     // setup category dropdown field
     $taxonomyRoot = self::getRootCategory();
     $categoryField = new TreeDropdownField('CategoryID', 'Category', 'TaxonomyTerm', 'ID', 'Name');
     //change this to 0 if you want the root category to show
     $categoryField->setTreeBaseID($taxonomyRoot->ID);
     $categoryField->setDescription(sprintf('Select one <a href="admin/taxonomy/TaxonomyTerm/EditForm/field/TaxonomyTerm/item/%d/#Root_Children">' . 'FAQ Category</a>', $taxonomyRoot->ID));
     $fields->addFieldToTab('Root.Main', $categoryField);
     $this->extend('updateGetCMSFields', $fields);
     return $fields;
 }
開發者ID:d-rivera-c,項目名稱:silverstripe-faq,代碼行數:19,代碼來源:FAQ.php


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