From ae05245b007774fc85c220a54e7478b3b54ac60f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9gis=20Hanol?= <regis@hanol.fr>
Date: Wed, 24 Jul 2019 18:38:44 +0200
Subject: [PATCH] DEV: plugin API to register User custom field types

---
 lib/plugin/instance.rb | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lib/plugin/instance.rb b/lib/plugin/instance.rb
index 9849d0847c4..67695e15a06 100644
--- a/lib/plugin/instance.rb
+++ b/lib/plugin/instance.rb
@@ -374,6 +374,13 @@ class Plugin::Instance
     end
   end
 
+  # Applies to all sites in a multisite environment. Ignores plugin.enabled?
+  def register_user_custom_field_type(name, type)
+    reloadable_patch do |plugin|
+      ::User.register_custom_field_type(name, type)
+    end
+  end
+
   def register_seedfu_fixtures(paths)
     paths = [paths] if !paths.kind_of?(Array)
     SeedFu.fixture_paths.concat(paths)