Method: Primer::Forms::ToggleSwitchForm.define_form_on

Defined in:
app/lib/primer/forms/toggle_switch_form.rb

.define_form_on(klass) ⇒ Object

Define the form on subclasses so render(Subclass.new) works as expected. (this is called directly on this class, but also on classes that inherit from this class)


37
38
39
40
41
42
43
44
45
# File 'app/lib/primer/forms/toggle_switch_form.rb', line 37

def self.define_form_on(klass)
  klass.form do |toggle_switch_form|
    input = Dsl::ToggleSwitchInput.new(
      builder: toggle_switch_form.builder, form: self, **@system_arguments
    )

    toggle_switch_form.send(:add_input, input)
  end
end