Sha256: aab304d90fd402cd7849ce3a6e74b8c7f7625220bfdc47b9850f0358cb99ef1e

Contents?: true

Size: 575 Bytes

Versions: 35

Compression:

Stored size: 575 Bytes

Contents

# frozen_string_literal: true

module Spotlight
  # Factory for picking the right page content renderer
  module PageContent
    def self.for(page, attribute)
      content_type = page.content_type
      content_class = Spotlight::PageContent.const_get(content_type) if Spotlight::PageContent.const_defined?(content_type)
      content_class ||= default_page_content_class

      content_class.parse(page, attribute)
    end

    def self.default_page_content_class
      Spotlight::PageContent.const_get(Spotlight::Engine.config.default_page_content_type)
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
blacklight-spotlight-3.0.0.alpha.8 app/models/spotlight/page_content.rb
blacklight-spotlight-3.0.0.alpha.7 app/models/spotlight/page_content.rb
blacklight-spotlight-3.0.0.alpha.6 app/models/spotlight/page_content.rb
blacklight-spotlight-3.0.0.alpha.5 app/models/spotlight/page_content.rb
blacklight-spotlight-3.0.0.alpha.4 app/models/spotlight/page_content.rb
blacklight-spotlight-3.0.0.alpha.3 app/models/spotlight/page_content.rb
blacklight-spotlight-3.0.0.alpha.2 app/models/spotlight/page_content.rb
blacklight-spotlight-3.0.0.alpha.1 app/models/spotlight/page_content.rb
blacklight-spotlight-2.13.0 app/models/spotlight/page_content.rb
blacklight-spotlight-2.12.1 app/models/spotlight/page_content.rb
blacklight-spotlight-2.12.0 app/models/spotlight/page_content.rb
blacklight-spotlight-2.11.0 app/models/spotlight/page_content.rb
blacklight-spotlight-2.10.0 app/models/spotlight/page_content.rb
blacklight-spotlight-2.9.0 app/models/spotlight/page_content.rb
blacklight-spotlight-2.8.0 app/models/spotlight/page_content.rb