Class: Locomotive::Liquid::Tags::LinkTo

Inherits:
Hybrid
  • Object
show all
Includes:
ActionView::Helpers::UrlHelper, PathHelper
Defined in:
lib/locomotive/liquid/tags/link_to.rb

Constant Summary

Constants included from PathHelper

PathHelper::Syntax

Instance Method Summary collapse

Methods included from PathHelper

#initialize, #render_path

Methods inherited from Hybrid

#parse

Instance Method Details

#render(context) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/locomotive/liquid/tags/link_to.rb', line 9

def render(context)
  render_path(context) do |page, path|
    label = label_from_page(page)

    if @render_as_block
      context.scopes.last['target'] = page
      label = super.html_safe
    end

    link_to label, path
  end
end

#wrong_syntax!Object

Raises:

  • (SyntaxError)


22
23
24
# File 'lib/locomotive/liquid/tags/link_to.rb', line 22

def wrong_syntax!
  raise SyntaxError.new("Syntax Error in 'link_to' - Valid syntax: link_to page_handle, locale es (locale is optional)")
end