In Silverstripe 4, the download file must be published before it is visible to the public side of the site.
If I create $ Page with $ has_one Image :: Class, and then also assign $ owns [] to this image, the downloaded image will be published when this page is published.
However, if I create the following structure of data objects, it will not.
Class Item extends DataObject{
$has_one[
'ItemImage'=>Image::Class,
'Catalog'=>'Catalog'
];
$owns[
'ItemImage'
]
}
Class Catalog extend DataObject{
$has_many[
'Items'=>'Item'
]
$owns[
'Items'
]
public function getCMSFields(){
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Items', GridField::create('Items', 'Items', $this->Items(), GridFieldConfig_RecordEditor::create()));
return $fields;
}
}
If I create a catalog and create elements with images inside it, and then save it, it will not publish the downloaded images. I have to manually: 1. Select an image 2. Edit the original 3. Publish
There should be an easier way for the user.
source
share