Class: Blacklight::MetadataFieldComponent
- Inherits:
-
Component
- Object
- ViewComponent::Base
- Component
- Blacklight::MetadataFieldComponent
show all
- Defined in:
- app/components/blacklight/metadata_field_component.rb
Constant Summary
Constants inherited
from Component
Component::EXCLUDE_VARIABLES
Instance Method Summary
collapse
Methods inherited from Component
compiler, config, #inspect
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
|