Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Easier way to add widgets in addons #1189

Closed
duncanmcclean opened this issue Jan 9, 2020 · 0 comments
Closed

Easier way to add widgets in addons #1189

duncanmcclean opened this issue Jan 9, 2020 · 0 comments

Comments

@duncanmcclean
Copy link
Member

I've done some source diving in the codebase around widgets, as the documentation on it is yet to be written.

Right now you need to do something like this to register a widget (although I haven't actually managed to get the last part working (the register extensions in app folder part)

$this->app->instance('statamic.widgets', collect());

$this->app['statamic.widgets']['recent_orders'] = RecentOrdersWidget::class;

$this->registerExtensionsInAppFolder('Widgets', 'statamic.widgets');

What I was thinking is that it would be easier to register the same way that tags and listeners are registered, simply like this.

protected $widgets = [
       RecentOrdersWidget::class,
];

I'm happy to have a look at implementing this in a pull request if you want 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant