DEV: API for plugins to add post update params and handlers (#12505)

This commit is contained in:
Mark VanLandingham
2021-03-24 10:22:16 -05:00
committed by GitHub
parent e7fb45cc29
commit 371afc45e0
5 changed files with 47 additions and 1 deletions

View File

@@ -337,6 +337,13 @@ class Plugin::Instance
end
end
# Add a permitted_update_param to Post, respecting if the plugin is enabled
def add_permitted_post_update_param(attribute, &block)
reloadable_patch do |plugin|
::Post.plugin_permitted_update_params[attribute] = { plugin: plugin, handler: block }
end
end
# Add validation method but check that the plugin is enabled
def validate(klass, name, &block)
klass = klass.to_s.classify.constantize