Class: Hyrax::FormBuilder

Inherits:
SimpleForm::FormBuilder
  • Object
show all
Defined in:
app/builders/hyrax/form_builder.rb

Instance Method Summary collapse

Instance Method Details

#input_label(attribute_name, options = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/builders/hyrax/form_builder.rb', line 4

def input_label(attribute_name, options = {})
  options = options.dup
  options[:input_html] = options.except(:as, :boolean_style, :collection, :label_method, :value_method, *ATTRIBUTE_COMPONENTS)
  options = @defaults.deep_dup.deep_merge(options) if @defaults

  input      = find_input(attribute_name, options)
  wrapper    = find_wrapper(input.input_type, options)
  components = (wrapper.components.map(&:namespace) & ATTRIBUTE_COMPONENTS) + [:input]
  components.map { |component| SimpleForm::Wrappers::Leaf.new(component) }

  input.label.html_safe
end