git it working with the SSViewer::current:theme().
it is only set at frontend.
I needed to extend the canView function, otherwise the available check will be done only at the load/init of the page. But the link to this page would be still there.
How it works:
in class Page:
function canView($member=null){
$ret = parent::canView();
$theme = SSViewer::current_theme();
if(!empty($theme)) {
# do your custom check
$ret = customCheck();
}
return $ret;
}
in controller:
function init(){
parent:init();
$check = $this->_customCheck(); # the same as above
if(empty($check)) {
# do something
}
}