Class: Spotlight::CustomField
- Inherits:
 - 
      ActiveRecord::Base
      
        
- Object
 - ActiveRecord::Base
 - Spotlight::CustomField
 
 
- Extended by:
 - FriendlyId
 
- Defined in:
 - app/models/spotlight/custom_field.rb
 
Overview
Exhibit custom fields
Instance Method Summary collapse
- #configured_to_display? ⇒ Boolean
 - #label ⇒ Object
 - #label=(label) ⇒ Object
 - #short_description ⇒ Object
 - #short_description=(short_description) ⇒ Object
 - #solr_field ⇒ Object
 
Instance Method Details
#configured_to_display? ⇒ Boolean
      53 54 55 56 57 58 59  | 
    
      # File 'app/models/spotlight/custom_field.rb', line 53 def configured_to_display? index_fields_config && index_fields_config['enabled'] && view_types.any? do |view| index_fields_config[view.to_s] end end  | 
  
#label ⇒ Object
      36 37 38 39 40 41 42 43  | 
    
      # File 'app/models/spotlight/custom_field.rb', line 36 def label conf = if field && blacklight_configuration&.index_fields&.key?(field) blacklight_configuration.index_fields[field].reverse_merge(configuration) else configuration end conf['label'] || conf[:label] end  | 
  
#label=(label) ⇒ Object
      30 31 32 33 34  | 
    
      # File 'app/models/spotlight/custom_field.rb', line 30 def label=(label) configuration['label'] = label update_blacklight_configuration_label label end  | 
  
#short_description ⇒ Object
      49 50 51  | 
    
      # File 'app/models/spotlight/custom_field.rb', line 49 def short_description configuration['short_description'] end  | 
  
#short_description=(short_description) ⇒ Object
      45 46 47  | 
    
      # File 'app/models/spotlight/custom_field.rb', line 45 def short_description=(short_description) configuration['short_description'] = short_description end  | 
  
#solr_field ⇒ Object
      61 62 63 64 65 66 67 68  | 
    
      # File 'app/models/spotlight/custom_field.rb', line 61 def solr_field if field&.starts_with?(solr_field_prefix) # backwards compatibility with pre-0.9 custom fields field else "#{solr_field_prefix}#{field || field_name}" end end  |