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
View Replies: View Best Answer
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
}