Skip to content

Commit

Permalink
Property shortcut for registering addon widgets. Closes #1189
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonvarga committed Jan 9, 2020
1 parent 87dbc87 commit 6633cc0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Providers/AddonServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ abstract class AddonServiceProvider extends ServiceProvider
protected $tags = [];
protected $fieldtypes = [];
protected $modifiers = [];
protected $widgets = [];
protected $commands = [];
protected $stylesheets = [];
protected $scripts = [];
Expand All @@ -37,6 +38,7 @@ public function boot()
->bootTags()
->bootFieldtypes()
->bootModifiers()
->bootWidgets()
->bootCommands()
->bootSchedule()
->bootStylesheets()
Expand Down Expand Up @@ -88,6 +90,15 @@ protected function bootModifiers()
return $this;
}

protected function bootWidgets()
{
foreach ($this->widgets as $class) {
$class::register();
}

return $this;
}

protected function bootCommands()
{
if ($this->app->runningInConsole()) {
Expand Down

0 comments on commit 6633cc0

Please sign in to comment.