/** * Add a tab with an upload field to the owner.config.images_tab_name or self.config.tab_name tab. * * @param FieldList $fields */ public function updateCMSFields(FieldList $fields) { $fields->removeByName(self::FieldName); if ($this->showOnCMSForm()) { // tab name can be set on the owner config.images_tab_name or use the extensions config.tab_name $tabName = $this()->config()->get('images_tab_name') ?: parent::get_config_setting('tab_name'); $fields->addFieldToTab($tabName, $field = new DisplayLogicWrapper(new SelectUploadField(self::FieldName, $this->getFieldLabel(), $this()->{self::FieldName}()))); if ($label = $this()->getTranslationForContentType('ImagesLabel')) { $field->setTitle($label); } if ($note = $this()->getTranslationForContentType('ImagesNote')) { $field->setRightTitle($note); } } }