Can you get the Collection Object while in an on_start() Function?

Permalink
The documentation says:

on_start
This is one of the first things that fires, it fires so early that several objects may not be available yet, (such as the collection object).

Is there a way to get the collection object?

ijessup
 
ijessup replied on at Permalink Best Answer Reply
ijessup
Yes.

$c = Request::get()->getRequestedPage();
if(is_object($c)) {
   // $c is the collection object, if one is available.
}
sk01 replied on at Permalink Reply
sk01
just in case somebody wants to do this in 5.7:

public function on_start()
{
    $instance = \Request::getInstance();
    $page = Page::getByPath($instance->getPath());
    // Do whatever you like with this
}

This website stores cookies on your computer. These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media. To find out more about the cookies we use, see our Privacy Policy.