HansSchouten / PHPageBuilder

A drag and drop page builder to manage pages in any PHP project
https://www.phpagebuilder.com
MIT License
721 stars 177 forks source link

Add extension support to PHPageBuilder. Allow blocks, layouts & assets to be added outside of a theme. #128

Closed Demonicious closed 2 years ago

Demonicious commented 2 years ago

When using PHPageBuilder in a CMS-environment, often you want plugins / modules to have the ability to create their own blocks, layouts and assets. This functionality should now be available in PHPageBuilder.

This pr adds an Extension class that can be used to register blocks / layouts from anywhere in the project. This could be used from within a plugin, composer package or more.

A new helper phpb_registered_assets($location = 'header'); is also added to get an array of all assets registered by extensions for use within layouts.

HansSchouten commented 2 years ago

Looks good, thanks for the addition!