Skip to Content Skip to Search
Methods
F
O
P

Instance Public methods

field_type()

# File app/serializers/v2/custom_field/custom_field_serializer.rb, line 11
def field_type
  if object.multiple
    "multiple-select"
  elsif object.checkbox? # FIXME: Widget lacks support for the m-checkbox (Mailchimp checkbox) field_type
    "checkbox"
  else
    object.field_type
  end
end

options()

# File app/serializers/v2/custom_field/custom_field_serializer.rb, line 21
def options
  object.options.gsub(/\r\n/, "").split(",").map do |option|
    value = option.strip

    {label: value, value: value}
  end
end

options?()

# File app/serializers/v2/custom_field/custom_field_serializer.rb, line 29
def options?
  ["select", "radio"].include?(object.field_type)
end

placeholder?()

# File app/serializers/v2/custom_field/custom_field_serializer.rb, line 33
def placeholder?
  ["text", "textarea", "select"].include?(object.field_type)
end