I try to extend the Rainlab.Pages plugin with a fileupload functionality:
use RainLab\Pages\Classes\Page as PageController;
public function boot() {
Event::listen('backend.form.extendFields', function ($widget) {
if (
!$widget->getController() instanceof \RainLab\Pages\Controllers\Index ||
!$widget->model instanceof PageController
) {
return;
}
$widget->model->attachMany = [
'attachments' => 'System\Models\File', 'order' => 'sort_order'
];
$widget->addTabFields([
'attachments' => [
'tab' => 'Attachments',
'label' => 'Files',
'type' => 'fileupload'
]
]);
});
}
But the model seems not to have the methods which are required by the fileupload:
Call to undefined method RainLab\Pages\Classes\Page::hasRelation()
How can I add file attachment functionality to the Pages plugin?