Sha256: 1fb995f063f66f7dd62ba1a0cb9d59f1010f699be9e585b772912052f5c212b6
Contents?: true
Size: 1.41 KB
Versions: 16
Compression:
Stored size: 1.41 KB
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, view_type: nil) @field = field @layout = layout || Blacklight::MetadataFieldLayoutComponent @view_type = view_type @show = show end def label if @show show_field_label @field.label('show') else index_field_label @field.label end end def render? @field.render_field? end ## # Render the index field label for a document # # Translations for index field labels should go under blacklight.search.fields # They are picked up from there by a value "%{label}" in blacklight.search.index.label # @return [String] def index_field_label label html_escape t(:"blacklight.search.index.#{@view_type}.label", default: :'blacklight.search.index.label', label: label) end ## # Render the show field label for a document # # @return [String] def show_field_label label t(:'blacklight.search.show.label', label: label) end end end
Version data entries
16 entries across 16 versions & 2 rubygems