|
10 | 10 | use tobimori\DreamForm\DreamForm; |
11 | 11 |
|
12 | 12 | if ( |
13 | | - version_compare(App::version() ?? '0.0.0', '5.0.0-beta.1', '<') === true || |
| 13 | + version_compare(App::version() ?? '0.0.0', '5.0.0-rc.3', '<') === true || |
14 | 14 | version_compare(App::version() ?? '0.0.0', '6.0.0', '>') === true |
15 | 15 | ) { |
16 | 16 | throw new Exception('Kirby DreamForm requires Kirby 5'); |
|
48 | 48 | ); |
49 | 49 |
|
50 | 50 | // register plugin |
51 | | -App::plugin('tobimori/dreamform', [ |
52 | | - 'api' => require __DIR__ . '/config/api.php', |
53 | | - 'options' => require __DIR__ . '/config/options.php', |
54 | | - 'sections' => require __DIR__ . '/config/sections.php', |
55 | | - 'fields' => require __DIR__ . '/config/fields.php', |
56 | | - 'areas' => require __DIR__ . '/config/areas.php', |
57 | | - 'permissions' => [ |
58 | | - 'accessForms' => true, |
59 | | - 'createForms' => true, |
60 | | - 'updateForms' => true, |
61 | | - 'deleteForms' => true, |
62 | | - 'duplicateForms' => true, |
63 | | - 'changeFormTitle' => true, |
64 | | - 'changeFormStatus' => true, |
65 | | - 'accessSubmissions' => true, |
66 | | - 'deleteSubmissions' => true, |
67 | | - ], |
68 | | - 'pageModels' => [ |
69 | | - 'forms' => \tobimori\DreamForm\Models\FormsPage::class, |
70 | | - 'form' => \tobimori\DreamForm\Models\FormPage::class, |
71 | | - 'submission' => \tobimori\DreamForm\Models\SubmissionPage::class, |
72 | | - ], |
73 | | - 'hooks' => require_once __DIR__ . '/config/hooks.php', |
74 | | - 'blockMethods' => require_once __DIR__ . '/config/blockMethods.php', |
75 | | - 'blueprints' => [ |
76 | | - 'files/dreamform-upload' => __DIR__ . '/blueprints/files/dreamform-upload.yml', |
77 | | - 'pages/forms' => require_once __DIR__ . '/blueprints/pages/forms.php', |
78 | | - 'pages/form' => require_once __DIR__ . '/blueprints/pages/form.php', |
79 | | - 'pages/submission' => require_once __DIR__ . '/blueprints/pages/submission.php', |
| 51 | +App::plugin( |
| 52 | + 'tobimori/dreamform', |
| 53 | + extends: [ |
| 54 | + 'api' => require __DIR__ . '/config/api.php', |
| 55 | + 'options' => require __DIR__ . '/config/options.php', |
| 56 | + 'sections' => require __DIR__ . '/config/sections.php', |
| 57 | + 'fields' => require __DIR__ . '/config/fields.php', |
| 58 | + 'areas' => require __DIR__ . '/config/areas.php', |
| 59 | + 'permissions' => [ |
| 60 | + 'accessForms' => true, |
| 61 | + 'createForms' => true, |
| 62 | + 'updateForms' => true, |
| 63 | + 'deleteForms' => true, |
| 64 | + 'duplicateForms' => true, |
| 65 | + 'changeFormTitle' => true, |
| 66 | + 'changeFormStatus' => true, |
| 67 | + 'accessSubmissions' => true, |
| 68 | + 'deleteSubmissions' => true, |
| 69 | + ], |
| 70 | + 'pageModels' => [ |
| 71 | + 'forms' => \tobimori\DreamForm\Models\FormsPage::class, |
| 72 | + 'form' => \tobimori\DreamForm\Models\FormPage::class, |
| 73 | + 'submission' => \tobimori\DreamForm\Models\SubmissionPage::class, |
| 74 | + ], |
| 75 | + 'hooks' => require_once __DIR__ . '/config/hooks.php', |
| 76 | + 'blockMethods' => require_once __DIR__ . '/config/blockMethods.php', |
| 77 | + 'blueprints' => [ |
| 78 | + 'files/dreamform-upload' => __DIR__ . '/blueprints/files/dreamform-upload.yml', |
| 79 | + 'pages/forms' => require_once __DIR__ . '/blueprints/pages/forms.php', |
| 80 | + 'pages/form' => require_once __DIR__ . '/blueprints/pages/form.php', |
| 81 | + 'pages/submission' => require_once __DIR__ . '/blueprints/pages/submission.php', |
80 | 82 |
|
81 | | - 'dreamform/tabs/form-submissions' => require_once __DIR__ . '/blueprints/tabs/form-submissions.php', |
82 | | - 'dreamform/fields/success' => __DIR__ . '/blueprints/fields/success.yml', |
83 | | - 'dreamform/fields/options' => __DIR__ . '/blueprints/fields/options.yml', |
84 | | - 'dreamform/fields/key' => __DIR__ . '/blueprints/fields/key.yml', |
85 | | - 'dreamform/fields/label' => __DIR__ . '/blueprints/fields/label.yml', |
86 | | - 'dreamform/fields/placeholder' => __DIR__ . '/blueprints/fields/placeholder.yml', |
87 | | - 'dreamform/fields/error-message' => __DIR__ . '/blueprints/fields/error-message.yml', |
88 | | - 'dreamform/fields/required' => __DIR__ . '/blueprints/fields/required.yml', |
89 | | - 'dreamform/fields/static-dynamic-toggles' => __DIR__ . '/blueprints/fields/static-dynamic-toggles.yml', |
90 | | - 'dreamform/fields/actions' => require_once __DIR__ . '/blueprints/fields/actions.php', |
91 | | - 'dreamform/fields/fields' => require_once __DIR__ . '/blueprints/fields/fields.php', |
92 | | - 'dreamform/fields/field' => require_once __DIR__ . '/blueprints/fields/field.php', |
93 | | - 'dreamform/fields/form' => require_once __DIR__ . '/blueprints/fields/form.php', |
94 | | - 'dreamform/fields/email-template' => require_once __DIR__ . '/blueprints/fields/email-template.php', |
95 | | - 'dreamform/fields/writer-with-fields' => require_once __DIR__ . '/blueprints/fields/writer-with-fields.php', |
96 | | - 'dreamform/fields/writer' => require_once __DIR__ . '/blueprints/fields/writer.php', |
97 | | - ], |
98 | | - 'templates' => [ |
99 | | - 'emails/dreamform.html' => __DIR__ . '/templates/emails/dreamform.html.php', |
100 | | - 'emails/dreamform' => __DIR__ . '/templates/emails/dreamform.php', |
101 | | - ], |
102 | | - 'snippets' => [ |
103 | | - 'dreamform/form' => __DIR__ . '/snippets/form.php', |
104 | | - 'dreamform/guards' => __DIR__ . '/snippets/guards.php', |
105 | | - 'dreamform/success' => __DIR__ . '/snippets/success.php', |
106 | | - 'dreamform/inactive' => __DIR__ . '/snippets/inactive.php', |
107 | | - 'dreamform/session' => __DIR__ . '/snippets/session.php', |
108 | | - 'dreamform/fields/text' => __DIR__ . '/snippets/fields/text.php', |
109 | | - 'dreamform/fields/textarea' => __DIR__ . '/snippets/fields/textarea.php', |
110 | | - 'dreamform/fields/number' => __DIR__ . '/snippets/fields/number.php', |
111 | | - 'dreamform/fields/email' => __DIR__ . '/snippets/fields/email.php', |
112 | | - 'dreamform/fields/hidden' => __DIR__ . '/snippets/fields/hidden.php', |
113 | | - 'dreamform/fields/select' => __DIR__ . '/snippets/fields/select.php', |
114 | | - 'dreamform/fields/pages' => __DIR__ . '/snippets/fields/pages.php', |
115 | | - 'dreamform/fields/checkbox' => __DIR__ . '/snippets/fields/checkbox.php', |
116 | | - 'dreamform/fields/radio' => __DIR__ . '/snippets/fields/radio.php', |
117 | | - 'dreamform/fields/button' => __DIR__ . '/snippets/fields/button.php', |
118 | | - 'dreamform/fields/file-upload' => __DIR__ . '/snippets/fields/file-upload.php', |
119 | | - 'dreamform/fields/partials/error' => __DIR__ . '/snippets/fields/partials/error.php', |
120 | | - 'dreamform/fields/partials/label' => __DIR__ . '/snippets/fields/partials/label.php', |
121 | | - 'dreamform/fields/partials/wrapper' => __DIR__ . '/snippets/fields/partials/wrapper.php', |
122 | | - 'dreamform/guards/csrf' => __DIR__ . '/snippets/guards/csrf.php', |
123 | | - 'dreamform/guards/honeypot' => __DIR__ . '/snippets/guards/honeypot.php', |
124 | | - 'dreamform/guards/turnstile' => __DIR__ . '/snippets/guards/turnstile.php', |
125 | | - ], |
126 | | - // get all files from /translations and register them as language files |
127 | | - 'translations' => A::keyBy( |
128 | | - A::map( |
129 | | - Dir::files(__DIR__ . '/translations'), |
130 | | - function ($file) { |
131 | | - $translations = []; |
132 | | - foreach (Json::read(__DIR__ . '/translations/' . $file) as $key => $value) { |
133 | | - $translations["dreamform.{$key}"] = $value; |
134 | | - } |
| 83 | + 'dreamform/tabs/form-submissions' => require_once __DIR__ . '/blueprints/tabs/form-submissions.php', |
| 84 | + 'dreamform/fields/success' => __DIR__ . '/blueprints/fields/success.yml', |
| 85 | + 'dreamform/fields/options' => __DIR__ . '/blueprints/fields/options.yml', |
| 86 | + 'dreamform/fields/key' => __DIR__ . '/blueprints/fields/key.yml', |
| 87 | + 'dreamform/fields/label' => __DIR__ . '/blueprints/fields/label.yml', |
| 88 | + 'dreamform/fields/placeholder' => __DIR__ . '/blueprints/fields/placeholder.yml', |
| 89 | + 'dreamform/fields/error-message' => __DIR__ . '/blueprints/fields/error-message.yml', |
| 90 | + 'dreamform/fields/required' => __DIR__ . '/blueprints/fields/required.yml', |
| 91 | + 'dreamform/fields/static-dynamic-toggles' => __DIR__ . '/blueprints/fields/static-dynamic-toggles.yml', |
| 92 | + 'dreamform/fields/actions' => require_once __DIR__ . '/blueprints/fields/actions.php', |
| 93 | + 'dreamform/fields/fields' => require_once __DIR__ . '/blueprints/fields/fields.php', |
| 94 | + 'dreamform/fields/field' => require_once __DIR__ . '/blueprints/fields/field.php', |
| 95 | + 'dreamform/fields/form' => require_once __DIR__ . '/blueprints/fields/form.php', |
| 96 | + 'dreamform/fields/email-template' => require_once __DIR__ . '/blueprints/fields/email-template.php', |
| 97 | + 'dreamform/fields/writer-with-fields' => require_once __DIR__ . '/blueprints/fields/writer-with-fields.php', |
| 98 | + 'dreamform/fields/writer' => require_once __DIR__ . '/blueprints/fields/writer.php', |
| 99 | + ], |
| 100 | + 'templates' => [ |
| 101 | + 'emails/dreamform.html' => __DIR__ . '/templates/emails/dreamform.html.php', |
| 102 | + 'emails/dreamform' => __DIR__ . '/templates/emails/dreamform.php', |
| 103 | + ], |
| 104 | + 'snippets' => [ |
| 105 | + 'dreamform/form' => __DIR__ . '/snippets/form.php', |
| 106 | + 'dreamform/guards' => __DIR__ . '/snippets/guards.php', |
| 107 | + 'dreamform/success' => __DIR__ . '/snippets/success.php', |
| 108 | + 'dreamform/inactive' => __DIR__ . '/snippets/inactive.php', |
| 109 | + 'dreamform/session' => __DIR__ . '/snippets/session.php', |
| 110 | + 'dreamform/fields/text' => __DIR__ . '/snippets/fields/text.php', |
| 111 | + 'dreamform/fields/textarea' => __DIR__ . '/snippets/fields/textarea.php', |
| 112 | + 'dreamform/fields/number' => __DIR__ . '/snippets/fields/number.php', |
| 113 | + 'dreamform/fields/email' => __DIR__ . '/snippets/fields/email.php', |
| 114 | + 'dreamform/fields/hidden' => __DIR__ . '/snippets/fields/hidden.php', |
| 115 | + 'dreamform/fields/select' => __DIR__ . '/snippets/fields/select.php', |
| 116 | + 'dreamform/fields/pages' => __DIR__ . '/snippets/fields/pages.php', |
| 117 | + 'dreamform/fields/checkbox' => __DIR__ . '/snippets/fields/checkbox.php', |
| 118 | + 'dreamform/fields/radio' => __DIR__ . '/snippets/fields/radio.php', |
| 119 | + 'dreamform/fields/button' => __DIR__ . '/snippets/fields/button.php', |
| 120 | + 'dreamform/fields/file-upload' => __DIR__ . '/snippets/fields/file-upload.php', |
| 121 | + 'dreamform/fields/partials/error' => __DIR__ . '/snippets/fields/partials/error.php', |
| 122 | + 'dreamform/fields/partials/label' => __DIR__ . '/snippets/fields/partials/label.php', |
| 123 | + 'dreamform/fields/partials/wrapper' => __DIR__ . '/snippets/fields/partials/wrapper.php', |
| 124 | + 'dreamform/guards/csrf' => __DIR__ . '/snippets/guards/csrf.php', |
| 125 | + 'dreamform/guards/honeypot' => __DIR__ . '/snippets/guards/honeypot.php', |
| 126 | + 'dreamform/guards/turnstile' => __DIR__ . '/snippets/guards/turnstile.php', |
| 127 | + ], |
| 128 | + // get all files from /translations and register them as language files |
| 129 | + 'translations' => A::keyBy( |
| 130 | + A::map( |
| 131 | + Dir::files(__DIR__ . '/translations'), |
| 132 | + function ($file) { |
| 133 | + $translations = []; |
| 134 | + foreach (Json::read(__DIR__ . '/translations/' . $file) as $key => $value) { |
| 135 | + $translations["dreamform.{$key}"] = $value; |
| 136 | + } |
135 | 137 |
|
136 | | - return A::merge( |
137 | | - ['lang' => F::name($file)], |
138 | | - $translations |
139 | | - ); |
140 | | - } |
141 | | - ), |
142 | | - 'lang' |
143 | | - ) |
144 | | -]); |
| 138 | + return A::merge( |
| 139 | + ['lang' => F::name($file)], |
| 140 | + $translations |
| 141 | + ); |
| 142 | + } |
| 143 | + ), |
| 144 | + 'lang' |
| 145 | + ) |
| 146 | + ], |
| 147 | +); |
0 commit comments