<?php

/*
 * This file is part of eSales Media ContentHelperBundle
 *
 * (c) Benjamin Roth
 *
 * @license proprietary
 */

namespace EsalesMedia\ContentHelperBundle\FrontendModule;

use Contao\ArticleModel;

/**
 * Extends columns start content element
 */
class ArticleListModule extends \Contao\ModuleArticleList
{

    /**
     * Generate the module
     */
    protected function compile()
    {
        parent::compile();

        $articles = array();
        foreach ($this->Template->articles as $article)
        {
            if (($Article = ArticleModel::findByPk($article['articleId'])) !== null && $Article->hideInArticleList)
            {
                continue;
            }
            $articles[] = $article;
        }
        $this->Template->articles = $articles;
    }
}