Module: Hyrax::Renderers::ConfiguredMicrodata
- Included in:
- AttributeRenderer
- Defined in:
- app/renderers/hyrax/renderers/configured_microdata.rb
Overview
Instance Method Summary collapse
- #microdata?(field) ⇒ Boolean
- #microdata_object?(field) ⇒ Boolean
- #microdata_object_attributes(field) ⇒ Object
- #microdata_property(field) ⇒ Object
- #microdata_type(field) ⇒ Object
- #microdata_value_attributes(field) ⇒ Object
Instance Method Details
#microdata?(field) ⇒ Boolean
4 5 6 7 |
# File 'app/renderers/hyrax/renderers/configured_microdata.rb', line 4 def microdata?(field) return false unless Hyrax.config.display_microdata? translate_microdata(field: field, field_context: 'property', default: false) end |
#microdata_object?(field) ⇒ Boolean
9 10 11 12 |
# File 'app/renderers/hyrax/renderers/configured_microdata.rb', line 9 def microdata_object?(field) return false unless Hyrax.config.display_microdata? translate_microdata(field: field, field_context: 'type', default: false) end |
#microdata_object_attributes(field) ⇒ Object
14 15 16 17 18 19 20 |
# File 'app/renderers/hyrax/renderers/configured_microdata.rb', line 14 def microdata_object_attributes(field) if microdata_object?(field) { itemprop: microdata_property(field), itemscope: '', itemtype: microdata_type(field) } else {} end end |
#microdata_property(field) ⇒ Object
22 23 24 |
# File 'app/renderers/hyrax/renderers/configured_microdata.rb', line 22 def microdata_property(field) translate_microdata(field: field, field_context: 'property') end |
#microdata_type(field) ⇒ Object
26 27 28 |
# File 'app/renderers/hyrax/renderers/configured_microdata.rb', line 26 def microdata_type(field) translate_microdata(field: field, field_context: 'type') end |
#microdata_value_attributes(field) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'app/renderers/hyrax/renderers/configured_microdata.rb', line 30 def microdata_value_attributes(field) if microdata?(field) field_context = microdata_object?(field) ? :value : :property { itemprop: translate_microdata(field: field, field_context: field_context) } else {} end end |