This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
I trying to make attachMany file relation in theme Settings section of October CMS. In my own plugin i wrote
use Cms\Classes\Theme;
use Cms\Models\ThemeData;
use System\Classes\PluginBase;
use System\Models\File;
class Plugin extends PluginBase
{
public function boot()
{
ThemeData::extend(function($model){
$model->attachMany = [ "images" => File::class ];
});
}
public function registerComponents()
{
}
public function registerSettings()
{
}
}
And in theme.yaml of my theme
form:
fields:
images:
label: images
mode: image
useCaption: true
imageWidth: '100'
thumbOptions:
mode: crop
extension: auto
span: auto
type: fileupload
So in Backend->Settings->CMS->Front-end Theme appeared new button "Customize" and my field images inside. But when i choose Upload I can select only one file!
So it works like attachOne instead of attachMany. Seems like the boot() method of Plugin doesn't work at all.
What am I doing wrong?
The theme model is special and automatically assign fields of type "fileupload" to its $attachOne relation.
ref. https://github.com/octobercms/october/blob/master/modules/cms/models/ThemeData.php#L127-L130
Last updated
marc.jauvin24240 said:
The theme model is special and automatically assign fields of type "fileupload" to its $attachOne relation.
ref. https://motox3m.co/ https://github.com/octobercms/october/blob/master/modules/cms/models/ThemeData.php#L127-L130
Thanks@marc.jauvin24240 . I have done like instruction
1-4 of 4