Class: Spotlight::UploadFieldConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/spotlight/upload_field_config.rb

Overview

A class to model the configuration required to build the Document Upload form. This configuration is also used in other places around the application (e.g. Metadata Field Config) See Spotlight::Engine.config.upload_fields for where this is consumed We should look into changing this to a standard blacklight field config in Blacklight 7

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(blacklight_options: {}, field_name:, form_field_type: :text_field, label: nil, solr_fields: nil) ⇒ UploadFieldConfig

Returns a new instance of UploadFieldConfig.



11
12
13
14
15
16
17
# File 'lib/spotlight/upload_field_config.rb', line 11

def initialize(blacklight_options: {}, field_name:, form_field_type: :text_field, label: nil, solr_fields: nil)
  @blacklight_options = blacklight_options
  @field_name = field_name
  @form_field_type = form_field_type
  @solr_fields = solr_fields
  @label = label || field_name
end

Instance Attribute Details

#blacklight_optionsObject (readonly)

Returns the value of attribute blacklight_options.



10
11
12
# File 'lib/spotlight/upload_field_config.rb', line 10

def blacklight_options
  @blacklight_options
end

#field_nameObject (readonly) Also known as: solr_field

Returns the value of attribute field_name.



10
11
12
# File 'lib/spotlight/upload_field_config.rb', line 10

def field_name
  @field_name
end

#form_field_typeObject (readonly)

Returns the value of attribute form_field_type.



10
11
12
# File 'lib/spotlight/upload_field_config.rb', line 10

def form_field_type
  @form_field_type
end

#solr_fieldsObject (readonly)

Returns the value of attribute solr_fields.



10
11
12
# File 'lib/spotlight/upload_field_config.rb', line 10

def solr_fields
  @solr_fields
end

Instance Method Details

#labelObject

Allows a proc to be set as the label



23
24
25
26
27
# File 'lib/spotlight/upload_field_config.rb', line 23

def label
  return @label.call if @label.is_a?(Proc)

  @label
end