core-bundle/src/Resources/contao/modules/ModuleArticlenav.php
public function generate()
	{
		if (TL_MODE == 'BE')
		{
			$objTemplate = new BackendTemplate('be_wildcard');
			$objTemplate->wildcard = '### ' . Utf8::strtoupper($GLOBALS['TL_LANG']['FMD']['articlenav'][0]) . ' ###';
			$objTemplate->title = $this->headline;
			$objTemplate->id = $this->id;
			$objTemplate->link = $this->name;
			$objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;

			return $objTemplate->parse();
		}

		/** @var PageModel $objPage */
		global $objPage;

		$this->objArticles = ArticleModel::findPublishedWithTeaserByPidAndColumn($objPage->id, $this->strColumn);

		// Return if there are no articles
		if ($this->objArticles === null)
		{
			return '';
		}

		// Redirect to the first article if no article is selected
		if (!Input::get('articles'))
		{
			if (!$this->loadFirst)
			{
				return '';
			}

			/** @var ArticleModel $objArticle */
			$objArticle = $this->objArticles->current();
			$strAlias = $objArticle->alias ?: $objArticle->id;

			$this->redirect($objPage->getFrontendUrl('/articles/' . $strAlias));
		}

		return parent::generate();
	}
public function generate()
	{
		if (TL_MODE == 'BE')
		{
			$objTemplate = new BackendTemplate('be_wildcard');
			$objTemplate->wildcard = '### ' . Utf8::strtoupper($GLOBALS['TL_LANG']['FMD']['articlenav'][0]) . ' ###';
			$objTemplate->title = $this->headline;
			$objTemplate->id = $this->id;
			$objTemplate->link = $this->name;
			$objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;

			return $objTemplate->parse();
		}

		/** @var PageModel $objPage */
		global $objPage;

		$this->objArticles = ArticleModel::findPublishedWithTeaserByPidAndColumn($objPage->id, $this->strColumn);

		// Return if there are no articles
		if ($this->objArticles === null)
		{
			return '';
		}

		// Redirect to the first article if no article is selected
		if (!Input::get('articles'))
		{
			if (!$this->loadFirst)
			{
				return '';
			}

			/** @var ArticleModel $objArticle */
			$objArticle = $this->objArticles->current();
			$strAlias = $objArticle->alias ?: $objArticle->id;

			$this->redirect($objPage->getFrontendUrl('/articles/' . $strAlias));
		}

		return parent::generate();
	}
Do not display the module if there are no articles

@return string