rollthecloudinc / quell

Climate aware CMS breaking web apps free from carbon emissions.
https://demo.carbonfreed.app/pages/create-panel-page
GNU General Public License v3.0
14 stars 1 forks source link

Hooks #12

Open verti-go opened 3 years ago

verti-go commented 3 years ago

Hooks will be used to alter data objects and behavior through programmatic means without hacking into base modules to do so.

For example, adding custom validation criteria to a formly field being rendered on a panel page. Something that would otherwise be very difficult to achieve with the ui.

hooks are *special plugins

HooksPlugin->register(hook) ie. ALTER_FORMLY_FIELD_INSTANCE

This kind of gives rise to hierarchical plugins.

A plugin like a specific hook has child plugins perhaps.

HookPlugin HookPluginManager

register hook

hook is plugin itself

the problem is managers are currently responsible for managing plugins.

so the hook plugin would either need to be aware of the manager (dependent) or a separate plugin like:

HookInstance (?) -- maybe, i was think implementation but that also sounds a little convoluted Hook*manager

Perhaps registration of a hook creates a dynamic service for instances of that hook? -- might be a little difficult to achieve


Some recent thoughts on this.

Users should be able to alter the default crud adaptor configs for entities without needing to hack core. This present a perfect opportunity to begin thinking about hooks. Hooks can be used to provide this feature to users. Users will be able to amend or completely override the crud configuration for any entity in the platform. This would work similar to hookentity{entityName}__config in drupal 7. However, in our case we would be leveraging the plugin system some how like drupal does in 8 to manage hooks.

HTTP_INTERCEPTOR_BEFORE_ALTER

Register this hook

Subscribers to hook - aka hierarchical plugins

Either the base plugin manager supports hierarchical plugins or crate separate manager for this.

ng-druid commented 3 years ago

PluginAlter - modify plugin

ng-druid commented 3 years ago

plugin uses hooks

ng-druid commented 3 years ago

hooks->register<PluginAlter<FormlyField>>(new ...)

windbeneathyourwings commented 3 years ago

I Think this is going to be needed for completing state integration into panel pages. The inline context data part of a state requires the inline context name be part of the data with an id.

windbeneathyourwings commented 3 years ago

Instead of this I might be able to alter the InlineContext prior to persisting it to the database.