core-bundle/src/Resources/contao/library/Contao/Controller.php
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
				{
					$objUser = FrontendUser::getInstance();

					if (!\is_array($objUser->groups))
					{
						$blnReturn = false;
					}
					else
					{
						$groups = StringUtil::deserialize($objElement->groups);

						if (empty($groups) || !\is_array($groups) || !\count(array_intersect($groups, $objUser->groups)))
						{
							$blnReturn = false;
						}
					}
				}
			}

			// Show to guests only
			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;
	}
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
				{
					$objUser = FrontendUser::getInstance();

					if (!\is_array($objUser->groups))
					{
						$blnReturn = false;
					}
					else
					{
						$groups = StringUtil::deserialize($objElement->groups);

						if (empty($groups) || !\is_array($groups) || !\count(array_intersect($groups, $objUser->groups)))
						{
							$blnReturn = false;
						}
					}
				}
			}

			// Show to guests only
			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;
	}
Check whether an element is visible in the front end

@param Model|ContentModel|ModuleModel $objElement The element model

@return boolean True if the element is visible