public static function addPagesBreadcrumb($strKey='tl_page_node')
	{
		/** @var AttributeBagInterface $objSession */
		$objSession = System::getContainer()->get('session')->getBag('contao_backend');

		// Set a new node
		if (isset($_GET['pn']))
		{
			// Check the path (thanks to Arnaud Buchoux)
			if (Validator::isInsecurePath(Input::get('pn', true)))
			{
				throw new \RuntimeException('Insecure path ' . Input::get('pn', true));
			}

			$objSession->set($strKey, Input::get('pn', true));
			Controller::redirect(preg_replace('/&pn=[^&]*/', '', Environment::get('request')));
		}

		$intNode = $objSession->get($strKey);

		if ($intNode < 1)
		{
			return;
		}

		// Check the path (thanks to Arnaud Buchoux)
		if (Validator::isInsecurePath($intNode))
		{
			throw new \RuntimeException('Insecure path ' . $intNode);
		}

		$arrIds   = array();
		$arrLinks = array();
		$objUser  = BackendUser::getInstance();

		// Generate breadcrumb trail
		if ($intNode)
		{
			$intId = $intNode;
			$objDatabase = Database::getInstance();

			do
			{
				$objPage = $objDatabase->prepare("SELECT * FROM tl_page WHERE id=?")
									   ->limit(1)
									   ->execute($intId);

				if ($objPage->numRows < 1)
				{
					// Currently selected page does not exist
					if ($intId == $intNode)
					{
						$objSession->set($strKey, 0);

						return;
					}

					break;
				}

				$arrIds[] = $intId;

				// No link for the active page
				if ($objPage->id == $intNode)
				{
					$arrLinks[] = self::addPageIcon($objPage->row(), '', null, '', true) . ' ' . $objPage->title;
				}
				else
				{
					$arrLinks[] = self::addPageIcon($objPage->row(), '', null, '', true) . ' <a href="' . self::addToUrl('pn='.$objPage->id) . '" title="'.StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['selectNode']).'">' . $objPage->title . '</a>';
				}

				// Do not show the mounted pages
				if (!$objUser->isAdmin && $objUser->hasAccess($objPage->id, 'pagemounts'))
				{
					break;
				}

				$intId = $objPage->pid;
			}
			while ($intId > 0 && $objPage->type != 'root');
		}

		// Check whether the node is mounted
		if (!$objUser->hasAccess($arrIds, 'pagemounts'))
		{
			$objSession->set($strKey, 0);
			throw new AccessDeniedException('Page ID ' . $intNode . ' is not mounted.');
		}

		// Limit tree
		$GLOBALS['TL_DCA']['tl_page']['list']['sorting']['root'] = array($intNode);

		// Add root link
		$arrLinks[] = Image::getHtml('pagemounts.svg') . ' <a href="' . self::addToUrl('pn=0') . '" title="'.StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['selectAllNodes']).'">' . $GLOBALS['TL_LANG']['MSC']['filterAll'] . '</a>';
		$arrLinks = array_reverse($arrLinks);

		// Insert breadcrumb menu
		$GLOBALS['TL_DCA']['tl_page']['list']['sorting']['breadcrumb'] .= '

<nav aria-label="' . $GLOBALS['TL_LANG']['MSC']['breadcrumbMenu'] . '">
  <ul id="tl_breadcrumb">
    <li>' . implode(' › </li><li>', $arrLinks) . '</li>
  </ul>
</nav>';
	}
public static function addPagesBreadcrumb($strKey='tl_page_node')
	{
		
		$objSession = System::getContainer()->get('session')->getBag('contao_backend');

		
		if (isset($_GET['pn']))
		{
			
			if (Validator::isInsecurePath(Input::get('pn', true)))
			{
				throw new \RuntimeException('Insecure path ' . Input::get('pn', true));
			}

			$objSession->set($strKey, Input::get('pn', true));
			Controller::redirect(preg_replace('/&pn=[^&]*/', '', Environment::get('request')));
		}

		$intNode = $objSession->get($strKey);

		if ($intNode < 1)
		{
			return;
		}

		
		if (Validator::isInsecurePath($intNode))
		{
			throw new \RuntimeException('Insecure path ' . $intNode);
		}

		$arrIds   = array();
		$arrLinks = array();
		$objUser  = BackendUser::getInstance();

		
		if ($intNode)
		{
			$intId = $intNode;
			$objDatabase = Database::getInstance();

			do
			{
				$objPage = $objDatabase->prepare("SELECT * FROM tl_page WHERE id=?")
									   ->limit(1)
									   ->execute($intId);

				if ($objPage->numRows < 1)
				{
					
					if ($intId == $intNode)
					{
						$objSession->set($strKey, 0);

						return;
					}

					break;
				}

				$arrIds[] = $intId;

				
				if ($objPage->id == $intNode)
				{
					$arrLinks[] = self::addPageIcon($objPage->row(), '', null, '', true) . ' ' . $objPage->title;
				}
				else
				{
					$arrLinks[] = self::addPageIcon($objPage->row(), '', null, '', true) . ' <a href="' . self::addToUrl('pn='.$objPage->id) . '" title="'.StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['selectNode']).'">' . $objPage->title . '</a>';
				}

				
				if (!$objUser->isAdmin && $objUser->hasAccess($objPage->id, 'pagemounts'))
				{
					break;
				}

				$intId = $objPage->pid;
			}
			while ($intId > 0 && $objPage->type != 'root');
		}

		
		if (!$objUser->hasAccess($arrIds, 'pagemounts'))
		{
			$objSession->set($strKey, 0);
			throw new AccessDeniedException('Page ID ' . $intNode . ' is not mounted.');
		}

		
		$GLOBALS['TL_DCA']['tl_page']['list']['sorting']['root'] = array($intNode);

		
		$arrLinks[] = Image::getHtml('pagemounts.svg') . ' <a href="' . self::addToUrl('pn=0') . '" title="'.StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['selectAllNodes']).'">' . $GLOBALS['TL_LANG']['MSC']['filterAll'] . '</a>';
		$arrLinks = array_reverse($arrLinks);

		
		$GLOBALS['TL_DCA']['tl_page']['list']['sorting']['breadcrumb'] .= '

<nav aria-label="' . $GLOBALS['TL_LANG']['MSC']['breadcrumbMenu'] . '">
  <ul id="tl_breadcrumb">
    <li>' . implode(' › </li><li>', $arrLinks) . '</li>
  </ul>
</nav>';
	}
public static function addPagesBreadcrumb ( $ strKey = 'tl_page_node' ) { /** @var AttributeBagInterface $objSession */ $ objSession = System :: getContainer ( ) -> get ( 'session' ) -> getBag ( 'contao_backend' ) ; // Set a new node if ( isset ( $ _GET [ 'pn' ] ) ) { // Check the path (thanks to Arnaud Buchoux) if ( Validator :: isInsecurePath ( Input :: get ( 'pn' , true ) ) ) { throw new \ RuntimeException ( 'Insecure path ' . Input :: get ( 'pn' , true ) ) ; } $ objSession -> set ( $ strKey , Input :: get ( 'pn' , true ) ) ; Controller :: redirect ( preg_replace ( '/&pn=[^&]*/' , '' , Environment :: get ( 'request' ) ) ) ; } $ intNode = $ objSession -> get ( $ strKey ) ; if ( $ intNode < 1 ) { return ; } // Check the path (thanks to Arnaud Buchoux) if ( Validator :: isInsecurePath ( $ intNode ) ) { throw new \ RuntimeException ( 'Insecure path ' . $ intNode ) ; } $ arrIds = array ( ) ; $ arrLinks = array ( ) ; $ objUser = BackendUser :: getInstance ( ) ; // Generate breadcrumb trail if ( $ intNode ) { $ intId = $ intNode ; $ objDatabase = Database :: getInstance ( ) ; do { $ objPage = $ objDatabase -> prepare ( "SELECT * FROM tl_page WHERE id=?" ) -> limit ( 1 ) -> execute ( $ intId ) ; if ( $ objPage -> numRows < 1 ) { // Currently selected page does not exist if ( $ intId == $ intNode ) { $ objSession -> set ( $ strKey , 0 ) ; return ; } break ; } $ arrIds [ ] = $ intId ; // No link for the active page if ( $ objPage -> id == $ intNode ) { $ arrLinks [ ] = self :: addPageIcon ( $ objPage -> row ( ) , '' , null , '' , true ) . ' ' . $ objPage -> title ; } else { $ arrLinks [ ] = self :: addPageIcon ( $ objPage -> row ( ) , '' , null , '' , true ) . ' <a href="' . self :: addToUrl ( 'pn=' . $ objPage -> id ) . '" title="' . StringUtil :: specialchars ( $ GLOBALS [ 'TL_LANG' ] [ 'MSC' ] [ 'selectNode' ] ) . '">' . $ objPage -> title . '</a>' ; } // Do not show the mounted pages if ( ! $ objUser -> isAdmin && $ objUser -> hasAccess ( $ objPage -> id , 'pagemounts' ) ) { break ; } $ intId = $ objPage -> pid ; } while ( $ intId > 0 && $ objPage -> type != 'root' ) ; } // Check whether the node is mounted if ( ! $ objUser -> hasAccess ( $ arrIds , 'pagemounts' ) ) { $ objSession -> set ( $ strKey , 0 ) ; throw new AccessDeniedException ( 'Page ID ' . $ intNode . ' is not mounted.' ) ; } // Limit tree $ GLOBALS [ 'TL_DCA' ] [ 'tl_page' ] [ 'list' ] [ 'sorting' ] [ 'root' ] = array ( $ intNode ) ; // Add root link $ arrLinks [ ] = Image :: getHtml ( 'pagemounts.svg' ) . ' <a href="' . self :: addToUrl ( 'pn=0' ) . '" title="' . StringUtil :: specialchars ( $ GLOBALS [ 'TL_LANG' ] [ 'MSC' ] [ 'selectAllNodes' ] ) . '">' . $ GLOBALS [ 'TL_LANG' ] [ 'MSC' ] [ 'filterAll' ] . '</a>' ; $ arrLinks = array_reverse ( $ arrLinks ) ; // Insert breadcrumb menu $ GLOBALS [ 'TL_DCA' ] [ 'tl_page' ] [ 'list' ] [ 'sorting' ] [ 'breadcrumb' ] .= '

<nav aria-label="' . $ GLOBALS [ 'TL_LANG' ] [ 'MSC' ] [ 'breadcrumbMenu' ] . '">
  <ul id="tl_breadcrumb">
    <li>' . implode ( ' › </li><li>',  $ r rLinks)  . ' /li>
  </ul>
</nav>' ; }
Add a breadcrumb menu to the page tree

@param string $strKey

@throws AccessDeniedException
@throws \RuntimeException
Add a breadcrumb menu to the page tree