protected function compile()
	{
		/** @var PageModel $objPage */
		global $objPage;

		// Get all active pages
		$objPages = PageModel::findPublishedRegularWithoutGuestsByIds($this->pages);

		// Return if there are no pages
		if ($objPages === null)
		{
			return;
		}

		$arrPages = array();

		// Sort the array keys according to the given order
		if ($this->orderPages != '')
		{
			$tmp = StringUtil::deserialize($this->orderPages);

			if (!empty($tmp) && \is_array($tmp))
			{
				$arrPages = array_map(function () {}, array_flip($tmp));
			}
		}

		// Add the items to the pre-sorted array
		while ($objPages->next())
		{
			$arrPages[$objPages->id] = $objPages->current();
		}

		$items = array();
		$arrPages = array_values(array_filter($arrPages));

		/** @var PageModel[] $arrPages */
		foreach ($arrPages as $objSubpage)
		{
			$objSubpage->title = StringUtil::stripInsertTags($objSubpage->title);
			$objSubpage->pageTitle = StringUtil::stripInsertTags($objSubpage->pageTitle);

			// Get href
			switch ($objSubpage->type)
			{
				case 'redirect':
					$href = $objSubpage->url;
					break;

				case 'forward':
					if ($objSubpage->jumpTo)
					{
						$objNext = PageModel::findPublishedById($objSubpage->jumpTo);
					}
					else
					{
						$objNext = PageModel::findFirstPublishedRegularByPid($objSubpage->id);
					}

					if ($objNext instanceof PageModel)
					{
						$href = $objNext->getFrontendUrl();
						break;
					}
					// DO NOT ADD A break; STATEMENT

				default:
					$href = $objSubpage->getFrontendUrl();
					break;
			}

			$items[] = array
			(
				'href' => $href,
				'title' => StringUtil::specialchars($objSubpage->pageTitle ?: $objSubpage->title),
				'link' => $objSubpage->title,
				'active' => ($objPage->id == $objSubpage->id || ($objSubpage->type == 'forward' && $objPage->id == $objSubpage->jumpTo))
			);
		}

		$this->Template->items = $items;
		$this->Template->formId = 'tl_quicklink_' . $this->id;
		$this->Template->request = ampersand(Environment::get('request'), true);
		$this->Template->title = $this->customLabel ?: $GLOBALS['TL_LANG']['MSC']['quicklink'];
		$this->Template->button = StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['go']);
	}
protected function compile()
	{
		
		global $objPage;

		
		$objPages = PageModel::findPublishedRegularWithoutGuestsByIds($this->pages);

		
		if ($objPages === null)
		{
			return;
		}

		$arrPages = array();

		
		if ($this->orderPages != '')
		{
			$tmp = StringUtil::deserialize($this->orderPages);

			if (!empty($tmp) && \is_array($tmp))
			{
				$arrPages = array_map(function () {}, array_flip($tmp));
			}
		}

		
		while ($objPages->next())
		{
			$arrPages[$objPages->id] = $objPages->current();
		}

		$items = array();
		$arrPages = array_values(array_filter($arrPages));

		
		foreach ($arrPages as $objSubpage)
		{
			$objSubpage->title = StringUtil::stripInsertTags($objSubpage->title);
			$objSubpage->pageTitle = StringUtil::stripInsertTags($objSubpage->pageTitle);

			
			switch ($objSubpage->type)
			{
				case 'redirect':
					$href = $objSubpage->url;
					break;

				case 'forward':
					if ($objSubpage->jumpTo)
					{
						$objNext = PageModel::findPublishedById($objSubpage->jumpTo);
					}
					else
					{
						$objNext = PageModel::findFirstPublishedRegularByPid($objSubpage->id);
					}

					if ($objNext instanceof PageModel)
					{
						$href = $objNext->getFrontendUrl();
						break;
					}
					

				default:
					$href = $objSubpage->getFrontendUrl();
					break;
			}

			$items[] = array
			(
				'href' => $href,
				'title' => StringUtil::specialchars($objSubpage->pageTitle ?: $objSubpage->title),
				'link' => $objSubpage->title,
				'active' => ($objPage->id == $objSubpage->id || ($objSubpage->type == 'forward' && $objPage->id == $objSubpage->jumpTo))
			);
		}

		$this->Template->items = $items;
		$this->Template->formId = 'tl_quicklink_' . $this->id;
		$this->Template->request = ampersand(Environment::get('request'), true);
		$this->Template->title = $this->customLabel ?: $GLOBALS['TL_LANG']['MSC']['quicklink'];
		$this->Template->button = StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['go']);
	}
protected function compile ( ) { /** @var PageModel $objPage */ global $ objPage ; // Get all active pages $ objPages = PageModel :: findPublishedRegularWithoutGuestsByIds ( $ this -> pages ) ; // Return if there are no pages if ( $ objPages === null ) { return ; } $ arrPages = array ( ) ; // Sort the array keys according to the given order if ( $ this -> orderPages != '' ) { $ tmp = StringUtil :: deserialize ( $ this -> orderPages ) ; if ( ! empty ( $ tmp ) && \ is_array ( $ tmp ) ) { $ arrPages = array_map ( function ( ) { } , array_flip ( $ tmp ) ) ; } } // Add the items to the pre-sorted array while ( $ objPages -> next ( ) ) { $ arrPages [ $ objPages -> id ] = $ objPages -> current ( ) ; } $ items = array ( ) ; $ arrPages = array_values ( array_filter ( $ arrPages ) ) ; /** @var PageModel[] $arrPages */ foreach ( $ arrPages as $ objSubpage ) { $ objSubpage -> title = StringUtil :: stripInsertTags ( $ objSubpage -> title ) ; $ objSubpage -> pageTitle = StringUtil :: stripInsertTags ( $ objSubpage -> pageTitle ) ; // Get href switch ( $ objSubpage -> type ) { case 'redirect' : $ href = $ objSubpage -> url ; break ; case 'forward' : if ( $ objSubpage -> jumpTo ) { $ objNext = PageModel :: findPublishedById ( $ objSubpage -> jumpTo ) ; } else { $ objNext = PageModel :: findFirstPublishedRegularByPid ( $ objSubpage -> id ) ; } if ( $ objNext instanceof PageModel ) { $ href = $ objNext -> getFrontendUrl ( ) ; break ; } // DO NOT ADD A break; STATEMENT default : $ href = $ objSubpage -> getFrontendUrl ( ) ; break ; } $ items [ ] = array ( 'href' => $ href , 'title' => StringUtil :: specialchars ( $ objSubpage -> pageTitle ? : $ objSubpage -> title ) , 'link' => $ objSubpage -> title , 'active' => ( $ objPage -> id == $ objSubpage -> id || ( $ objSubpage -> type == 'forward' && $ objPage -> id == $ objSubpage -> jumpTo ) ) ) ; } $ this -> Template -> items = $ items ; $ this -> Template -> formId = 'tl_quicklink_' . $ this -> id ; $ this -> Template -> request = ampersand ( Environment :: get ( 'request' ) , true ) ; $ this -> Template -> title = $ this -> customLabel ? : $ GLOBALS [ 'TL_LANG' ] [ 'MSC' ] [ 'quicklink' ] ; $ this -> Template -> button = StringUtil :: specialchars ( $ GLOBALS [ 'TL_LANG' ] [ 'MSC' ] [ 'go' ] ) ; }
Generate the module
Generate the module