Sha256: b68d2ce966b515c279f9f7867e75bef64c78821922b2e2cf6c756cc21749144b
Contents?: true
Size: 1.01 KB
Versions: 16
Compression:
Stored size: 1.01 KB
Contents
#------------------------------------------------------------------------------ module Liquid class Snippet < DmCore::LiquidTag include DmCore::AccountHelper include DmCore::LiquidHelper #------------------------------------------------------------------------------ def render(context) output = '' if @attributes['slug'].present? cms_snippet = CmsSnippet.find_by_slug(@attributes['slug']) if cms_snippet output = context.registers[:view].render_content_item(cms_snippet) end end return output end #------------------------------------------------------------------------------ def self.details { name: self.tag_name, summary: 'Display a snippet', category: 'structure', description: <<-END_OF_DESCRIPTION Output the content of a snippet specified by the slug ~~~ {% snippet slug: 'some-snippet-slug'} ~~~ END_OF_DESCRIPTION } end end Template.register_tag('snippet', Snippet) end
Version data entries
16 entries across 16 versions & 1 rubygems