Class: ModsDisplay::Language
- Defined in:
- lib/mods_display/fields/language.rb
Instance Method Summary collapse
Methods inherited from Field
#initialize, #label, #render_in, #to_html
Constructor Details
This class inherits a constructor from ModsDisplay::Field
Instance Method Details
#fields ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/mods_display/fields/language.rb', line 5 def fields return_fields = @stanford_mods_elements.map do |language_element| next unless language_element.respond_to?(:languageTerm) language_element.languageTerm.map do |term| next unless term.attributes['type'].respond_to?(:value) && term.attributes['type'].value == 'code' ModsDisplay::Values.new( label: displayLabel(language_element) || displayLabel(term) || I18n.t('mods_display.language'), values: [language_codes[element_text(term)]] ) end.flatten.compact end.flatten.compact collapse_fields(return_fields) end |