How to publish an Image (has_many) added by an extension


#1

Silverstripe Version:
4.3
Question:

Hi ,
I’m writing a slider-modul. The modul is written as an extension that extends the page-type that needs the slider modul.
When I upload Images they get they get versioned as draft.
I put the owns-static to my extension, but that does not work,… Somehow I need to referenc to the owner->owns variabel I guess… how can I do that?

	class SliderExtension extends DataExtension{
		private static $db=[
		];
		 private static $has_many = [
				'Images'=>SliderImage::class,
		];
		public function updateCMSFields(FieldList $fields) {
				$fields->addFieldToTab('Root.Slider',UploadField::create('Images','Bilder'));
		}
		private static $owns=[
			'Images'
		];
	}

#2

Sorry it s working with the ode above. Only thing is,… that the draft lable does not disapear immediatly. I had to refresh the page…