vendor/memo_development/contao-portfolio-bundle/src/Module/ModulePortfolioReader.php line 45

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. /**
  3.  * @package   Memo\MemoPortfolioBundle
  4.  * @author    Media Motion AG
  5.  * @license   LGPL-3.0+
  6.  * @copyright Media Motion AG
  7.  */
  8. namespace Memo\PortfolioBundle\Module;
  9. use Contao\CoreBundle\Exception\PageNotFoundException;
  10. use Contao\Environment;
  11. use Memo\FoundationBundle\Module\FoundationModule;
  12. use Memo\PortfolioBundle\Model\PortfolioModel;
  13. class ModulePortfolioReader extends FoundationModule
  14. {
  15.     /**
  16.      * Template
  17.      * @var string
  18.      */
  19.     protected $strTemplate 'mod_portfolio_reader';
  20.     /**
  21.      * Generate module
  22.      */
  23.     protected function compile()
  24.     {
  25.         if (TL_MODE === 'FE')
  26.         {
  27.             global $objPage;
  28.             // Get auto_item (GET Parameter)
  29.             $strAlias \Input::get('auto_item');
  30.             // Check if there is an Alias in the URL and get the item by alias (this also filters by start/stop, looks for alias_en etc.)
  31.             if($strAlias != '' && $colItem PortfolioModel::getItemByTranslatedAlias($strAlias))
  32.             {
  33.                 // Set the MetaData for the detailpage
  34.                 $this->setMetaData$colItem );
  35.                 // Parse the item into an array (this also generates images, html-template etc.)
  36.                 $arrItems $this->parseItems$colItemnullfalse);
  37.                 // Define the data "raw" for custom template use
  38.                 $this->Template->setData$colItem->row() );
  39.                 // Set the custom template, if defined
  40.                 if( $this->customTpl )
  41.                 {
  42.                     $this->Template->strTemplate $this->customTpl;
  43.                 }
  44.                 // Pass the items to the template
  45.                 $this->Template->items $arrItems;
  46.                 // Parse the Template
  47.                 $this->Template->parse();
  48.             }
  49.             else
  50.             {
  51.                 throw new PageNotFoundException('Page not found: ' Environment::get('uri'));
  52.             }
  53.         }
  54.         else
  55.         {
  56.             // Get the automatic Backend-view
  57.             $this->parseBackendTemplate();
  58.         }
  59.     }
  60. }