Sha256: e2a77b437f6061e77e199e8c304f8e7f0a036502c130c02a6736d3ea159fe0f9
Contents?: true
Size: 1.1 KB
Versions: 3
Compression:
Stored size: 1.1 KB
Contents
module Scrivito # This class provides methods used to retrieve objects from CMS based an entry # in CMS of the obj_class <tt>NamedLink</tt>. # @api public class NamedLink # @api public class NotFound < StandardError end # This method will be called to retrieve the NamedLink {BasicObj Obj}. # By default it will look for the Obj at the path "_named_links". # Override this method only if you know what you are doing. # @api public def self.find_named_link_obj BasicObj.find_by_path("/_named_links") end # Returns the CMS object mapped to the given title or nil. # The title can be a string of symbol. # @api public def self.get_object(title, options = {}) link = named_links.find { |link| link.title == title.to_s } raise NotFound, "The NamedLink '#{title.to_s}' does not exist" unless link link.obj end def self.named_links named_link_obj = find_named_link_obj if named_link_obj named_link_obj.related_links else raise NotFound, "Couldn't find NamedLink CMS Object!" end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
scrivito_sdk-0.66.0 | lib/scrivito/named_link.rb |
scrivito_sdk-0.66.0.rc2 | lib/scrivito/named_link.rb |
scrivito_sdk-0.66.0.rc1 | lib/scrivito/named_link.rb |