Method: Comfy::CmsHelper#cms_snippet_render

Defined in:
app/helpers/comfy/cms_helper.rb

#cms_snippet_render(identifier, cms_site = @cms_site) ⇒ Object

Same as cms_snippet_content but cms tags will be expanded. Note that there is no page context, so snippet cannot contain fragment tags.



48
49
50
51
52
53
54
# File 'app/helpers/comfy/cms_helper.rb', line 48

def cms_snippet_render(identifier, cms_site = @cms_site)
  cms_site ||= cms_site_detect
  snippet = cms_site&.snippets&.find_by_identifier(identifier)
  return "" unless snippet
  r = ComfortableMexicanSofa::Content::Renderer.new(snippet)
  render inline: r.render(r.nodes(r.tokenize(snippet.content)))
end