Sha256: 026fa4175e716ade318b0bcb4e4264b4dc5435e05ca7b71bb01e190626ba7dc0

Contents?: true

Size: 1018 Bytes

Versions: 25

Compression:

Stored size: 1018 Bytes

Contents

# frozen_string_literal: true

module Blacklight
  class MetadataFieldComponent < Blacklight::Component
    with_collection_parameter :field

    # @param field [Blacklight::FieldPresenter]
    # @param layout [Blacklight::MetadataFieldLayoutComponent] alternate layout component to use
    # @param show [Boolean] are we showing only a single document (vs a list of search results); used for backwards-compatibility
    def initialize(field:, layout: nil, show: false)
      @field = field
      @layout = layout || Blacklight::MetadataFieldLayoutComponent
      @show = show
    end

    # @private
    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

    def render?
      @field.render_field?
    end
  end
end

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
blacklight-7.40.0 app/components/blacklight/metadata_field_component.rb
blacklight-7.39.0 app/components/blacklight/metadata_field_component.rb
blacklight-7.38.0 app/components/blacklight/metadata_field_component.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-7.37.0/app/components/blacklight/metadata_field_component.rb
blacklight-7.37.0 app/components/blacklight/metadata_field_component.rb
blacklight-7.36.2 app/components/blacklight/metadata_field_component.rb
blacklight-7.36.1 app/components/blacklight/metadata_field_component.rb
blacklight-7.36.0 app/components/blacklight/metadata_field_component.rb
blacklight-7.35.0 app/components/blacklight/metadata_field_component.rb
blacklight-7.34.0 app/components/blacklight/metadata_field_component.rb
blacklight-7.33.1 app/components/blacklight/metadata_field_component.rb
blacklight-7.33.0 app/components/blacklight/metadata_field_component.rb
blacklight-7.32.0 app/components/blacklight/metadata_field_component.rb
blacklight-7.31.0 app/components/blacklight/metadata_field_component.rb
blacklight-7.30.0 app/components/blacklight/metadata_field_component.rb
blacklight-7.29.0 app/components/blacklight/metadata_field_component.rb
blacklight-7.28.0 app/components/blacklight/metadata_field_component.rb
blacklight-7.27.1 app/components/blacklight/metadata_field_component.rb
blacklight-7.27.0 app/components/blacklight/metadata_field_component.rb
blacklight-7.26.1 app/components/blacklight/metadata_field_component.rb