Reputation: 372
I'm developing a web application using Laravel framework. I'm giving my users the ability to develop/install custom plugins in my application. I'm planning to do this using the event system. For instance whenever the dashboard.widgets.show
event fires, the custom plugins can listen to the event and provide a custom dashboard widget which will get rendered. But what if the widget need to have some sort of config options? Do I need to give them the ability to create new fields in the database? How does wordpress handles this? And is there any better way to have a plugin architecture in Laravel apps?
Upvotes: 1
Views: 95
Reputation: 3973
wordpress stores a serialized array of the settings. you can easily create a table called widget_options or something.. and save all your data there. when getting and settings values you need to set the table row id to the widget id and the value field to the serialized settings array. This can be easily done on your widget class.
You may also store a json string. Please read about the difference between json_encode and serialize here
Upvotes: 1