Sha256: cde0d65e3bc5cc5a9f4f868907e2801ab4e22d2542623961b007530e9e4ef75e

Contents?: true

Size: 566 Bytes

Versions: 6

Compression:

Stored size: 566 Bytes

Contents

# frozen_string_literal: true
module Blacklight
  class Configuration::SortField < Blacklight::Configuration::Field
    # @!attribute sort
    #   @return [String] the sort specification to use; defaults to the value of field (which is used in the user-facing parameters)

    def normalize! blacklight_config = nil
      super
      self.field ||= label.try(:parameterize)
      self.field ||= sort

      self.sort ||= self.field

      self
    end

    def validate!
      raise ArgumentError.new, "Must supply a sort string" if self.sort.nil?
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
blacklight-7.14.0 lib/blacklight/configuration/sort_field.rb
blacklight-7.13.2 lib/blacklight/configuration/sort_field.rb
blacklight-7.13.1 lib/blacklight/configuration/sort_field.rb
blacklight-7.13.0 lib/blacklight/configuration/sort_field.rb
blacklight-7.12.1 lib/blacklight/configuration/sort_field.rb
blacklight-7.12.0 lib/blacklight/configuration/sort_field.rb