lib/scrivito/configuration.rb in scrivito_sdk-1.1.1 vs lib/scrivito/configuration.rb in scrivito_sdk-1.2.0.rc1
- old
+ new
@@ -295,14 +295,25 @@
#
attr_writer :default_image_transformation
attr_reader :default_image_transformation
- # Configure a callback to be invoked when the Scrivito SDK delivers the homepage.
- # The given callback will receive the rack env
- # and must return an {BasicObj Obj} to be used as the homepage.
- # If no callback is configured, {BasicObj.root Obj.root} will be used as the default.
# @api public
+ #
+ # A callback that can be provided for determining the CMS object to be used when visiting
+ # the homepage. See {Scrivito::RoutingExtensions#scrivito_route scrivito_route} for
+ # details on how to define routes. The callback is called once per request and receives
+ # the rack environment as its only parameter. By default, the CMS object at the root
+ # path (+/+) is used as the homepage.
+ #
+ # @yield Rack environment of the current request
+ #
+ # @example
+ # Scrivito.configure do |config|
+ # config.choose_homepage do |env|
+ # Obj.root # Replace with code to set the homepage
+ # end
+ # end
def choose_homepage(&block)
self.choose_homepage_callback = block
end
def obj_formats