/** * Test if the current path is within the dashboard. * Optionally, a Page or path can be passed to test. * * @param Page | string $page (optional) * @return [boolean] */ public function inDashboard($page = false) { if ($page instanceof Page && !$page->isError()) { $path = $page->getCollectionPath(); } elseif (is_string($page)) { $path = $page; } else { $request = Request::get(); $path = $request->getRequestCollectionPath(); } return strpos($path, '/dashboard') === 0; }