Class: Blacklight::MetadataFieldComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/blacklight/metadata_field_component.rb

Instance Method Summary collapse

Methods inherited from Component

compiler

Constructor Details

#initialize(field:, layout: nil, show: false) ⇒ MetadataFieldComponent

Returns a new instance of MetadataFieldComponent.

Parameters:



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

#labelObject



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

Returns:

  • (Boolean)


27
28
29
# File 'app/components/blacklight/metadata_field_component.rb', line 27

def render?
  @field.render_field?
end