Sha256: e7ffc270e004e52c8eeeb1ff9d82a5346074930b4bc31b89dc611c2a52191919

Contents?: true

Size: 620 Bytes

Versions: 32

Compression:

Stored size: 620 Bytes

Contents

# frozen_string_literal: true

require 'spotlight/page_content/sir_trevor'

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

32 entries across 32 versions & 1 rubygems

Version Path
blacklight-spotlight-3.5.0.4 app/models/spotlight/page_content.rb
blacklight-spotlight-3.6.0.beta7 app/models/spotlight/page_content.rb
blacklight-spotlight-3.5.0.3 app/models/spotlight/page_content.rb
blacklight-spotlight-3.6.0.beta6 app/models/spotlight/page_content.rb
blacklight-spotlight-3.6.0.beta5 app/models/spotlight/page_content.rb
blacklight-spotlight-3.6.0.beta4 app/models/spotlight/page_content.rb
blacklight-spotlight-3.6.0.beta3 app/models/spotlight/page_content.rb
blacklight-spotlight-3.6.0.beta1 app/models/spotlight/page_content.rb
blacklight-spotlight-3.5.0.2 app/models/spotlight/page_content.rb
blacklight-spotlight-3.5.0.1 app/models/spotlight/page_content.rb
blacklight-spotlight-3.5.0 app/models/spotlight/page_content.rb
blacklight-spotlight-3.4.4.1 app/models/spotlight/page_content.rb
blacklight-spotlight-3.4.4 app/models/spotlight/page_content.rb
blacklight-spotlight-3.4.3 app/models/spotlight/page_content.rb
blacklight-spotlight-3.4.2.2 app/models/spotlight/page_content.rb
blacklight-spotlight-3.4.2.1 app/models/spotlight/page_content.rb
blacklight-spotlight-3.4.2 app/models/spotlight/page_content.rb
blacklight-spotlight-3.4.1 app/models/spotlight/page_content.rb
blacklight-spotlight-3.4.0 app/models/spotlight/page_content.rb
blacklight-spotlight-3.3.0 app/models/spotlight/page_content.rb