Sha256: 8df3cf78785c112ed1e61a98411132617d53ed5e0421478c5c1548c321f93327

Contents?: true

Size: 1.39 KB

Versions: 1

Compression:

Stored size: 1.39 KB

Contents

module Scrivito
  #
  # This helper contains methods for generating URLs that point to CMS content.
  # Use {Scrivito::RoutingHelper#scrivito_path} or {Scrivito::RoutingHelper#scrivito_url} when linking or
  # redirecting to CMS objects. These methods are available in both your views and your controllers.
  #
  # @api public
  #
  module RoutingHelper
    #
    # Returns the (URL-)path of a CMS object.
    #
    # @api public
    #
    # @param target [Obj, Link, Array<Link>, Binary]
    #   If +target+ is an +Array+ of +Links+, it must be non-empty.
    #   Only the first {Link} of the +Array+ is used.
    # @param options [Hash] include url settings such as path parameters or the protocol.
    #
    # @return [String]
    #
    def scrivito_path(target, options = {})
      CmsRouting.new(request, main_app, scrivito_engine).path_or_url(target, "path", options)
    end

    #
    # Returns the absolute URL of a CMS object.
    #
    # @api public
    #
    # @param target [Obj, Link, Array<Link>, Binary]
    #   If +target+ is an +Array+ of +Links+, it must be non-empty.
    #   Only the first {Link} of the +Array+ is used.
    # @param options [Hash] include url settings such as path parameters or the protocol.
    #
    # @return [String]
    #
    def scrivito_url(target, options = {})
      CmsRouting.new(request, main_app, scrivito_engine).path_or_url(target, "url", options)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scrivito_sdk-0.70.0.rc1 lib/scrivito/routing_helper.rb