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


PHP UploadField::setDescription方法代码示例

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


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

示例1: updateCMSFields

 function updateCMSFields(FieldList $fields)
 {
     $fields->insertAfter($tabset = new TabSet('ColoredImages'), 'Image');
     $tabset->push($uploadtab = new Tab('UploadImages'));
     $tabset->push($attributetab = new Tab('AssignAttribute'));
     $uploadtab->push($uf = new UploadField('Images', 'Images'));
     $uf->setDescription('Note: The product must be saved before attributes can be assigned to new uploaded images.');
     $attributetab->push($gf = GridField::create("ImageAttributes", "Images", $this->owner->Images(), GridFieldConfig_RelationEditor::create()->removeComponentsByType("GridFieldAddNewButton")->removeComponentsByType("GridFieldEditButton")->removeComponentsByType("GridFieldDataColumns")->removeComponentsByType("GridFieldDeleteAction")->addComponent($cols = new GridFieldEditableColumns())->addComponent(new GridFieldOrderableRows('Sort'))));
     $displayfields = array('Title' => array('title' => 'Title', 'field' => new ReadonlyField("Name")));
     //add drop-down color selection
     $colors = $this->owner->getColors();
     if ($colors->exists()) {
         $displayfields['ColorID'] = function ($record, $col, $grid) use($colors) {
             return DropdownField::create($col, "Color", $colors->map('ID', 'Value')->toArray())->setHasEmptyDefault(true);
         };
     }
     $cols->setDisplayFields($displayfields);
 }
开发者ID:helpfulrobot,项目名称:silvershop-coloredvariations,代码行数:18,代码来源:ColoredProductExtension.php

示例2: getCMSFieldsForColorScheme

 /**
  * Adds the CMS fields for the ColorScheme setting.
  * 
  * @param FieldList $fields Fields to update
  * 
  * @return void
  *
  * @author Sebastian Diel <sdiel@pixeltricks.de>
  * @since 26.09.2014
  */
 public function getCMSFieldsForColorScheme(FieldList $fields)
 {
     $colorSchemePath = Director::baseFolder() . '/silvercart/css';
     if (is_dir($colorSchemePath)) {
         if ($handle = opendir($colorSchemePath)) {
             $colorSchemes = new ArrayList();
             while (false !== ($entry = readdir($handle))) {
                 if (substr($entry, -4) != '.css') {
                     continue;
                 }
                 if (substr($entry, 0, 6) != 'color_') {
                     continue;
                 }
                 $colorSchemeName = substr($entry, 6, -4);
                 $colorSchemeFile = $colorSchemePath . '/' . $entry;
                 $lines = file($colorSchemeFile);
                 $backgroundColors = array();
                 $fontColors = array();
                 foreach ($lines as $line) {
                     if (strpos(strtolower($line), 'background-color') !== false && preg_match('/#[a-z|A-Z|0-9]{3,6}/', $line, $matches)) {
                         $backgroundColors[$matches[0]] = new ArrayData(array('Color' => $matches[0]));
                     } elseif (strpos(strtolower(trim($line)), 'color') === 0 && preg_match('/#[a-z|A-Z|0-9]{3,6}/', $line, $matches)) {
                         $fontColors[$matches[0]] = new ArrayData(array('Color' => $matches[0]));
                     }
                 }
                 $colorSchemes->push(new ArrayData(array('Name' => $colorSchemeName, 'Title' => _t('SilvercartConfig.ColorScheme_' . $colorSchemeName, ucfirst($colorSchemeName)), 'BackgroundColors' => new ArrayList($backgroundColors), 'FontColors' => new ArrayList($fontColors), 'IsActive' => $this->owner->ColorScheme == $colorSchemeName)));
             }
             closedir($handle);
         }
         $colorSchemes->sort('Title');
         $fields->removeByName('ColorScheme');
         $logoField = new UploadField('SilvercartLogo', $this->owner->fieldLabel('SilvercartLogo'));
         $logoField->setDescription($this->owner->fieldLabel('SilvercartLogoDesc'));
         // Build color scheme toggle group
         $colorSchemeConfigurationField = ToggleCompositeField::create('ColorSchemeConfiguration', $this->owner->fieldLabel('ColorSchemeConfiguration'), array($fields->dataFieldByName('Title'), $fields->dataFieldByName('Tagline'), $fields->dataFieldByName('Theme'), $logoField, new LiteralField('ColorScheme', $this->owner->customise(array('ColorSchemes' => $colorSchemes))->renderWith('ColorSchemeField'))))->setHeadingLevel(4)->setStartClosed(true);
         $fields->removeByName('Title');
         $fields->removeByName('Tagline');
         $fields->removeByName('Theme');
         $fields->addFieldToTab('Root.Main', $colorSchemeConfigurationField);
     } else {
         $fields->removeByName('ColorScheme');
     }
 }
开发者ID:silvercart,项目名称:silvercart,代码行数:53,代码来源:SilvercartSiteConfig.php


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