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

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

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

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

		if ($strNode == '')
		{
			return;
		}

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

		$rootDir = System::getContainer()->getParameter('kernel.project_dir');

		// Currently selected folder does not exist
		if (!is_dir($rootDir . '/' . $strNode))
		{
			$objSession->set($strKey, '');

			return;
		}

		$objUser  = BackendUser::getInstance();
		$strPath  = Config::get('uploadPath');
		$arrNodes = explode('/', preg_replace('/^' . preg_quote(Config::get('uploadPath'), '/') . '\//', '', $strNode));
		$arrLinks = array();

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

		// Generate breadcrumb trail
		foreach ($arrNodes as $strFolder)
		{
			$strPath .= '/' . $strFolder;

			// Do not show pages which are not mounted
			if (!$objUser->hasAccess($strPath, 'filemounts'))
			{
				continue;
			}

			// No link for the active folder
			if ($strPath == $strNode)
			{
				$arrLinks[] = Image::getHtml('folderC.svg') . ' ' . $strFolder;
			}
			else
			{
				$arrLinks[] = Image::getHtml('folderC.svg') . ' <a href="' . self::addToUrl('fn='.$strPath) . '" title="'.StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['selectNode']).'">' . $strFolder . '</a>';
			}
		}

		// Check whether the node is mounted
		if (!$objUser->hasAccess($strNode, 'filemounts'))
		{
			$objSession->set($strKey, '');
			throw new AccessDeniedException('Folder ID "' . $strNode . '" is not mounted');
		}

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

		// Insert breadcrumb menu
		$GLOBALS['TL_DCA']['tl_files']['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 addFilesBreadcrumb($strKey='tl_files_node')
	{
		
		$objSession = System::getContainer()->get('session')->getBag('contao_backend');

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

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

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

		if ($strNode == '')
		{
			return;
		}

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

		$rootDir = System::getContainer()->getParameter('kernel.project_dir');

		
		if (!is_dir($rootDir . '/' . $strNode))
		{
			$objSession->set($strKey, '');

			return;
		}

		$objUser  = BackendUser::getInstance();
		$strPath  = Config::get('uploadPath');
		$arrNodes = explode('/', preg_replace('/^' . preg_quote(Config::get('uploadPath'), '/') . '\
		$arrLinks = array();

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

		
		foreach ($arrNodes as $strFolder)
		{
			$strPath .= '/' . $strFolder;

			
			if (!$objUser->hasAccess($strPath, 'filemounts'))
			{
				continue;
			}

			
			if ($strPath == $strNode)
			{
				$arrLinks[] = Image::getHtml('folderC.svg') . ' ' . $strFolder;
			}
			else
			{
				$arrLinks[] = Image::getHtml('folderC.svg') . ' <a href="' . self::addToUrl('fn='.$strPath) . '" title="'.StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['selectNode']).'">' . $strFolder . '</a>';
			}
		}

		
		if (!$objUser->hasAccess($strNode, 'filemounts'))
		{
			$objSession->set($strKey, '');
			throw new AccessDeniedException('Folder ID "' . $strNode . '" is not mounted');
		}

		
		$GLOBALS['TL_DCA']['tl_files']['list']['sorting']['root'] = array($strNode);

		
		$GLOBALS['TL_DCA']['tl_files']['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 addFilesBreadcrumb ( $ strKey = 'tl_files_node' ) { /** @var AttributeBagInterface $objSession */ $ objSession = System :: getContainer ( ) -> get ( 'session' ) -> getBag ( 'contao_backend' ) ; // Set a new node if ( isset ( $ _GET [ 'fn' ] ) ) { // Check the path (thanks to Arnaud Buchoux) if ( Validator :: isInsecurePath ( Input :: get ( 'fn' , true ) ) ) { throw new \ RuntimeException ( 'Insecure path ' . Input :: get ( 'fn' , true ) ) ; } $ objSession -> set ( $ strKey , Input :: get ( 'fn' , true ) ) ; Controller :: redirect ( preg_replace ( '/(&|\?)fn=[^&]*/' , '' , Environment :: get ( 'request' ) ) ) ; } $ strNode = $ objSession -> get ( $ strKey ) ; if ( $ strNode == '' ) { return ; } // Check the path (thanks to Arnaud Buchoux) if ( Validator :: isInsecurePath ( $ strNode ) ) { throw new \ RuntimeException ( 'Insecure path ' . $ strNode ) ; } $ rootDir = System :: getContainer ( ) -> getParameter ( 'kernel.project_dir' ) ; // Currently selected folder does not exist if ( ! is_dir ( $ rootDir . '/' . $ strNode ) ) { $ objSession -> set ( $ strKey , '' ) ; return ; } $ objUser = BackendUser :: getInstance ( ) ; $ strPath = Config :: get ( 'uploadPath' ) ; $ arrNodes = explode ( '/' , preg_replace ( '/^' . preg_quote ( Config :: get ( 'uploadPath' ) , '/' ) . '\//' , '' , $ strNode ) ) ; $ arrLinks = array ( ) ; // Add root link $ arrLinks [ ] = Image :: getHtml ( 'filemounts.svg' ) . ' <a href="' . self :: addToUrl ( 'fn=' ) . '" title="' . StringUtil :: specialchars ( $ GLOBALS [ 'TL_LANG' ] [ 'MSC' ] [ 'selectAllNodes' ] ) . '">' . $ GLOBALS [ 'TL_LANG' ] [ 'MSC' ] [ 'filterAll' ] . '</a>' ; // Generate breadcrumb trail foreach ( $ arrNodes as $ strFolder ) { $ strPath .= '/' . $ strFolder ; // Do not show pages which are not mounted if ( ! $ objUser -> hasAccess ( $ strPath , 'filemounts' ) ) { continue ; } // No link for the active folder if ( $ strPath == $ strNode ) { $ arrLinks [ ] = Image :: getHtml ( 'folderC.svg' ) . ' ' . $ strFolder ; } else { $ arrLinks [ ] = Image :: getHtml ( 'folderC.svg' ) . ' <a href="' . self :: addToUrl ( 'fn=' . $ strPath ) . '" title="' . StringUtil :: specialchars ( $ GLOBALS [ 'TL_LANG' ] [ 'MSC' ] [ 'selectNode' ] ) . '">' . $ strFolder . '</a>' ; } } // Check whether the node is mounted if ( ! $ objUser -> hasAccess ( $ strNode , 'filemounts' ) ) { $ objSession -> set ( $ strKey , '' ) ; throw new AccessDeniedException ( 'Folder ID "' . $ strNode . '" is not mounted' ) ; } // Limit tree $ GLOBALS [ 'TL_DCA' ] [ 'tl_files' ] [ 'list' ] [ 'sorting' ] [ 'root' ] = array ( $ strNode ) ; // Insert breadcrumb menu $ GLOBALS [ 'TL_DCA' ] [ 'tl_files' ] [ '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 file tree

@param string $strKey

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