Skip to content

Commit 6633cc0

Browse files
committed
Property shortcut for registering addon widgets. Closes #1189
1 parent 87dbc87 commit 6633cc0

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/Providers/AddonServiceProvider.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ abstract class AddonServiceProvider extends ServiceProvider
1818
protected $tags = [];
1919
protected $fieldtypes = [];
2020
protected $modifiers = [];
21+
protected $widgets = [];
2122
protected $commands = [];
2223
protected $stylesheets = [];
2324
protected $scripts = [];
@@ -37,6 +38,7 @@ public function boot()
3738
->bootTags()
3839
->bootFieldtypes()
3940
->bootModifiers()
41+
->bootWidgets()
4042
->bootCommands()
4143
->bootSchedule()
4244
->bootStylesheets()
@@ -88,6 +90,15 @@ protected function bootModifiers()
8890
return $this;
8991
}
9092

93+
protected function bootWidgets()
94+
{
95+
foreach ($this->widgets as $class) {
96+
$class::register();
97+
}
98+
99+
return $this;
100+
}
101+
91102
protected function bootCommands()
92103
{
93104
if ($this->app->runningInConsole()) {

0 commit comments

Comments
 (0)