Sha256: 6c7c10ca242d360415c3d14205a1b84ad12591402d6374b347bc5c8d42bf605f

Contents?: true

Size: 562 Bytes

Versions: 23

Compression:

Stored size: 562 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&.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

23 entries across 23 versions & 2 rubygems

Version Path
blacklight-8.8.0 lib/blacklight/configuration/sort_field.rb
blacklight-8.7.0 lib/blacklight/configuration/sort_field.rb
blacklight-8.6.1 lib/blacklight/configuration/sort_field.rb
blacklight-8.6.0 lib/blacklight/configuration/sort_field.rb
blacklight-8.5.1 lib/blacklight/configuration/sort_field.rb
blacklight-8.5.0 lib/blacklight/configuration/sort_field.rb
blacklight-8.4.0 lib/blacklight/configuration/sort_field.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-8.3.0/lib/blacklight/configuration/sort_field.rb
blacklight-8.3.0 lib/blacklight/configuration/sort_field.rb
blacklight-8.2.2 lib/blacklight/configuration/sort_field.rb
blacklight-8.2.1 lib/blacklight/configuration/sort_field.rb
blacklight-8.2.0 lib/blacklight/configuration/sort_field.rb
blacklight-8.1.0 lib/blacklight/configuration/sort_field.rb
blacklight-8.0.1 lib/blacklight/configuration/sort_field.rb
blacklight-8.0.0 lib/blacklight/configuration/sort_field.rb
blacklight-8.0.0.beta8 lib/blacklight/configuration/sort_field.rb
blacklight-8.0.0.beta7 lib/blacklight/configuration/sort_field.rb
blacklight-8.0.0.beta6 lib/blacklight/configuration/sort_field.rb
blacklight-8.0.0.beta5 lib/blacklight/configuration/sort_field.rb
blacklight-8.0.0.beta4 lib/blacklight/configuration/sort_field.rb