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-4.3.6 app/models/spotlight/page_content.rb
blacklight-spotlight-4.3.5 app/models/spotlight/page_content.rb
blacklight-spotlight-4.3.4 app/models/spotlight/page_content.rb
blacklight-spotlight-4.3.3 app/models/spotlight/page_content.rb
blacklight-spotlight-4.3.2 app/models/spotlight/page_content.rb
blacklight-spotlight-4.3.1 app/models/spotlight/page_content.rb
blacklight-spotlight-4.3.0 app/models/spotlight/page_content.rb
blacklight-spotlight-4.2.0 app/models/spotlight/page_content.rb
blacklight-spotlight-4.1.2 app/models/spotlight/page_content.rb
blacklight-spotlight-4.1.1 app/models/spotlight/page_content.rb
blacklight-spotlight-4.1.0 app/models/spotlight/page_content.rb
blacklight-spotlight-4.0.3 app/models/spotlight/page_content.rb
blacklight-spotlight-4.0.2 app/models/spotlight/page_content.rb
blacklight-spotlight-4.0.1 app/models/spotlight/page_content.rb
blacklight-spotlight-4.0.0 app/models/spotlight/page_content.rb
blacklight-spotlight-3.6.0.beta10 app/models/spotlight/page_content.rb
blacklight-spotlight-3.6.0.beta9 app/models/spotlight/page_content.rb
blacklight-spotlight-3.6.0.beta8 app/models/spotlight/page_content.rb
blacklight-spotlight-3.0.0.alpha.10 app/models/spotlight/page_content.rb
blacklight-spotlight-3.0.0.alpha.9 app/models/spotlight/page_content.rb