protected function is_visible($widget) { static $current_route; $widget->visible = TRUE; if (is_null($current_route)) { $current_route = Request::current()->uri(); $current_route = UTF8::strtolower($current_route); } // role based widget access if (!User::belongsto($widget->roles)) { $widget->visible = FALSE; } if ($widget->pages) { $pages = UTF8::strtolower($widget->pages); $page_match = Path::match_path($current_route, $pages); $widget->visible = !($widget->visibility xor $page_match); } return $widget; }