本文整理汇总了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);
}
示例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');
}
}