From 2157079d0926f78597f9e2928801137c77b9ab0f Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Thu, 17 Aug 2017 15:59:31 +0900 Subject: [PATCH] Add Plugin API to register a category custom field. --- lib/plugin/instance.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/plugin/instance.rb b/lib/plugin/instance.rb index a3caa4822ca..15db5872948 100644 --- a/lib/plugin/instance.rb +++ b/lib/plugin/instance.rb @@ -248,6 +248,12 @@ class Plugin::Instance end end + def register_category_custom_field_type(name, type) + reloadable_patch do |plugin| + Category.register_custom_field_type(name, type) if plugin.enabled? + end + end + def register_topic_custom_field_type(name, type) reloadable_patch do |plugin| ::Topic.register_custom_field_type(name, type) if plugin.enabled?