Class: Blacklight::MetadataFieldComponent
- Inherits:
-
Component
- Object
- ViewComponent::Base
- Component
- Blacklight::MetadataFieldComponent
- Defined in:
- app/components/blacklight/metadata_field_component.rb
Instance Method Summary collapse
-
#initialize(field:, layout: nil, show: false) ⇒ MetadataFieldComponent
constructor
A new instance of MetadataFieldComponent.
- #label ⇒ Object
- #render? ⇒ Boolean
Methods inherited from Component
Constructor Details
#initialize(field:, layout: nil, show: false) ⇒ MetadataFieldComponent
Returns a new instance of MetadataFieldComponent.
10 11 12 13 14 |
# File 'app/components/blacklight/metadata_field_component.rb', line 10 def initialize(field:, layout: nil, show: false) @field = field @layout = layout || Blacklight::MetadataFieldLayoutComponent @show = show end |
Instance Method Details
#label ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'app/components/blacklight/metadata_field_component.rb', line 17 def label Deprecation.silence(Blacklight::BlacklightHelperBehavior) do if @show helpers.render_document_show_field_label @field.document, label: @field.label('show'), field: @field.key else helpers.render_index_field_label @field.document, label: @field.label, field: @field.key end end end |
#render? ⇒ Boolean
27 28 29 |
# File 'app/components/blacklight/metadata_field_component.rb', line 27 def render? @field.render_field? end |