-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlugin.php
More file actions
executable file
·48 lines (40 loc) · 1.29 KB
/
Plugin.php
File metadata and controls
executable file
·48 lines (40 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php namespace ERegnier\EventGallery;
use System\Classes\PluginBase;
use Event;
use HendrikErz\Campaignr\Models\Event as EventModel;
use HendrikErz\Campaignr\Controllers\Events as EventsController;
class Plugin extends PluginBase
{
public $require = ['HendrikErz.Campaignr'];
public function boot()
{
// Extend all backend form usage
EventModel::extend(function($model)
{
$model->addJsonable([
'gallery'
]);
});
EventsController::extendFormFields(function($form, $model, $context)
{
if (!$model instanceof EventModel || $form->isNested) {
return;
}
// Add an extra birthday field
$form->addSecondaryTabFields([
'gallery' => [
'label' => 'Gallery',
'comment' => 'Select images',
'type' => 'repeater',
'tab' => 'hendrikerz.campaignr::lang.fields.tab_details',
'form' => [
'fields' => ['slide' => [
'label' => 'Image',
'type' => 'mediafinder',
'mode' => 'image'
]]]
]
]);
});
}
}