From 26749bd055af42757cd961d0c0b50de569a76b16 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Fri, 23 Sep 2022 16:23:41 +0200 Subject: [PATCH] Add asset requiring for backwards compatibility --- lib/custom_wizard/field.rb | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/custom_wizard/field.rb b/lib/custom_wizard/field.rb index ee0fc379..a4358296 100644 --- a/lib/custom_wizard/field.rb +++ b/lib/custom_wizard/field.rb @@ -135,7 +135,20 @@ class CustomWizard::Field @acbs ||= [] end - def self.register(type, plugin = nil, opts = {}) + def self.require_assets + Rails.logger.warn("Custom Wizard field regisration no longer requires asset registration. Support will be removed in v2.1.0.") + + @require_assets ||= {} + end + + def self.register(type, plugin = nil, opts = {}, legacy_opts = {}) + if opts.is_a?(Array) + Rails.logger.warn("Custom Wizard field regisration no longer requires asset registration. Support will be removed in v2.1.0.") + + require_assets[plugin] = opts + opts = legacy_opts + end + if type types[type.to_sym] ||= {} types[type.to_sym] = opts[:type_opts] if opts[:type_opts].present?