protected function getFormFieldAttributesTab($record, $context = []) { /** @var Tab $tab */ $tab = parent::getFormFieldAttributesTab($record, $context); $alignments = array('leftAlone' => _t('AssetAdmin.AlignmentLeftAlone', 'On the left, on its own.'), 'center' => _t('AssetAdmin.AlignmentCenter', 'Centered, on its own.'), 'left' => _t('AssetAdmin.AlignmentLeft', 'On the left, with text wrapping around.'), 'right' => _t('AssetAdmin.AlignmentRight', 'On the right, with text wrapping around.')); $tab->push(DropdownField::create('Alignment', _t('AssetAdmin.Alignment', 'Alignment'), $alignments)); $tab->push(FieldGroup::create(_t('AssetAdmin.ImageSpecs', 'Dimensions'), TextField::create('InsertWidth', _t('AssetAdmin.ImageWidth', 'Width'))->setMaxLength(5)->addExtraClass('flexbox-area-grow'), TextField::create('InsertHeight', _t('AssetAdmin.ImageHeight', 'Height'))->setMaxLength(5)->addExtraClass('flexbox-area-grow'))->addExtraClass('fill-width')); $tab->insertBefore('Caption', TextField::create('AltText', _t('AssetAdmin.AltText', 'Alternative text (alt)'))->setDescription(_t('AssetAdmin.AltTextDescription', 'Shown to screen readers or if image can\'t be displayed'))); $tab->insertAfter('AltText', TextField::create('TitleTooltip', _t('AssetAdmin.TitleTooltip', 'Title text (tooltip)'))->setDescription(_t('AssetAdmin.TitleTooltipDescription', 'For additional information about the image'))->setValue($record->Title)); return $tab; }
/** * @return FieldList */ public function getFields() { $fields = new FieldList(CompositeField::create(CompositeField::create(LiteralField::create("ImageFull", $this->getPreview()))->setName("FilePreviewImage")->addExtraClass('cms-file-info-preview'), CompositeField::create($this->getDetailFields())->setName("FilePreviewData")->addExtraClass('cms-file-info-data'))->setName("FilePreview")->addExtraClass('cms-file-info'), TextField::create('CaptionText', _t('HTMLEditorField.CAPTIONTEXT', 'Caption text')), DropdownField::create('CSSClass', _t('HTMLEditorField.CSSCLASS', 'Alignment / style'), array('leftAlone' => _t('HTMLEditorField.CSSCLASSLEFTALONE', 'On the left, on its own.'), 'center' => _t('HTMLEditorField.CSSCLASSCENTER', 'Centered, on its own.'), 'left' => _t('HTMLEditorField.CSSCLASSLEFT', 'On the left, with text wrapping around.'), 'right' => _t('HTMLEditorField.CSSCLASSRIGHT', 'On the right, with text wrapping around.'))), FieldGroup::create(_t('HTMLEditorField.IMAGEDIMENSIONS', 'Dimensions'), TextField::create('Width', _t('HTMLEditorField.IMAGEWIDTHPX', 'Width'), $this->getInsertWidth())->setMaxLength(5), TextField::create('Height', " x " . _t('HTMLEditorField.IMAGEHEIGHTPX', 'Height'), $this->getInsertHeight())->setMaxLength(5))->addExtraClass('dimensions last'), HiddenField::create('URL', false, $this->getURL()), HiddenField::create('FileID', false, $this->getFileID())); return $fields; }
/** * Get the search context from {@link File}, used to create the search form * as well as power the /search API endpoint. * * @return SearchContext */ public function getSearchContext() { $context = File::singleton()->getDefaultSearchContext(); // Customize fields $dateHeader = HeaderField::create('Date', _t('CMSSearch.FILTERDATEHEADING', 'Date'), 4); $dateFrom = DateField::create('CreatedFrom', _t('CMSSearch.FILTERDATEFROM', 'From'))->setConfig('showcalendar', true); $dateTo = DateField::create('CreatedTo', _t('CMSSearch.FILTERDATETO', 'To'))->setConfig('showcalendar', true); $dateGroup = FieldGroup::create($dateHeader, $dateFrom, $dateTo); $context->addField($dateGroup); /** @skipUpgrade */ $appCategories = array('archive' => _t('SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.AppCategoryArchive', 'Archive'), 'audio' => _t('SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.AppCategoryAudio', 'Audio'), 'document' => _t('SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.AppCategoryDocument', 'Document'), 'flash' => _t('SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.AppCategoryFlash', 'Flash', 'The fileformat'), 'image' => _t('SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.AppCategoryImage', 'Image'), 'video' => _t('SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.AppCategoryVideo', 'Video')); $context->addField($typeDropdown = new DropdownField('AppCategory', _t('SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.Filetype', 'File type'), $appCategories)); $typeDropdown->setEmptyString(' '); $currentfolderLabel = _t('SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.CurrentFolderOnly', 'Limit to current folder?'); $context->addField(new CheckboxField('CurrentFolderOnly', $currentfolderLabel)); $context->getFields()->removeByName('Title'); return $context; }