Module: ForestLiana::WidgetsHelper

Defined in:
app/helpers/forest_liana/widgets_helper.rb

Class Method Summary collapse

Class Method Details

.set_field_widget(field) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'app/helpers/forest_liana/widgets_helper.rb', line 42

def self.set_field_widget(field)

  if field[:widget]
    if @v1_to_v2_edit_widgets_mapping[field[:widget].to_sym]
      field[:widgetEdit] = {name: @v1_to_v2_edit_widgets_mapping[field[:widget].to_sym], parameters: {}}
    elsif @widget_edit_list.include?(field[:widget])
      field[:widgetEdit] = {name: field[:widget], parameters: {}}
    end
  end

  if !field.key?(:widgetEdit)
    field[:widgetEdit] = nil
  end

  field.delete(:widget)
end