public static function isVisibleElement(Model $objElement)
{
$blnReturn = true;
// Only apply the restrictions in the front end
if (TL_MODE == 'FE') {
// Protected element
if ($objElement->protected) {
if (!FE_USER_LOGGED_IN) {
$blnReturn = false;
} else {
$groups = \StringUtil::deserialize($objElement->groups);
if (empty($groups) || !is_array($groups) || !count(array_intersect($groups, \FrontendUser::getInstance()->groups))) {
$blnReturn = false;
}
}
} elseif ($objElement->guests && FE_USER_LOGGED_IN) {
$blnReturn = false;
}
}
// HOOK: add custom logic
if (isset($GLOBALS['TL_HOOKS']['isVisibleElement']) && is_array($GLOBALS['TL_HOOKS']['isVisibleElement'])) {
foreach ($GLOBALS['TL_HOOKS']['isVisibleElement'] as $callback) {
$blnReturn = static::importStatic($callback[0])->{$callback[1]}($objElement, $blnReturn);
}
}
return $blnReturn;
}