File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -24,10 +24,20 @@ class FormsServiceProvider extends CoreServiceProvider
2424
2525 public const EXTENSION_FORM_BUILDER = 'extension.form_builder';
2626
27+ public const FEATURE_ALLOW_SOMETHING = 'feature.form_allow_something';
28+
2729 protected $repositories = [
2830 FormsRepositoryInterface::class => FormsRepository::class
2931 ];
3032
33+ protected $features = [
34+ self::FEATURE_ALLOW_SOMETHING => [
35+ 'translation_key',
36+ true // boolean true if the feature has settings
37+ ],
38+ self::FEATURE_ALLOW_SOMETHING => 'translation_key'
39+ ];
40+
3141 protected $events = [
3242 FormWasSubmittedEvent::class => SendFormSubmissionEmailListener::class
3343 ];
Original file line number Diff line number Diff line change @@ -57,6 +57,11 @@ class CoreServiceProvider extends ServiceProvider
5757 */
5858 protected $ commands = [];
5959
60+ /**
61+ * @var array
62+ */
63+ protected $ features = [];
64+
6065 /**
6166 * @return void
6267 */
@@ -91,6 +96,9 @@ public function boot()
9196 // Extensions
9297 $ this ->registerExtensions ($ this ->extensions );
9398
99+ // Features
100+ $ this ->registerFeatures ($ this ->features );
101+
94102 // Permissions
95103 $ this ->registerPermissions ($ this ->permissions );
96104 }
@@ -163,6 +171,21 @@ protected function registerExtensions(array $extensions): void
163171 }
164172 }
165173
174+ /**
175+ * @param array $features
176+ */
177+ protected function registerFeatures (array $ features ): void
178+ {
179+ foreach ($ features as $ key => $ translation ) {
180+ if (\is_array ($ translation )) {
181+ ExtensionRegistrar::addFeature ($ key , $ translation [0 ], $ translation [1 ]);
182+ continue ;
183+ }
184+
185+ ExtensionRegistrar::addFeature ($ key , $ translation );
186+ }
187+ }
188+
166189 /**
167190 * @param array $permissions
168191 */
You can’t perform that action at this time.
0 commit comments