Skip to content

Commit

Permalink
Added support for tags in Calendar modules
Browse files Browse the repository at this point in the history
  • Loading branch information
hschottm committed Mar 7, 2016
1 parent 9a2c160 commit fc0fea4
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
3 changes: 2 additions & 1 deletion config/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* Contao Open Source CMS
*
* Copyright (c) 2005-2015 Leo Feyer
* Copyright (c) 2005-2016 Leo Feyer
*
* @license LGPL-3.0+
*/
Expand Down Expand Up @@ -41,6 +41,7 @@

// Modules
'Aurealis\ModuleArticle' => 'system/modules/tags/modules/ModuleArticle.php',
'Contao\ModuleCalendarTags' => 'system/modules/tags/modules/ModuleCalendarTags.php',
'Contao\ModuleEventlistTags' => 'system/modules/tags/modules/ModuleEventlistTags.php',
'Contao\ModuleEventReaderTags' => 'system/modules/tags/modules/ModuleEventReaderTags.php',
'Contao\ModuleFaqListTags' => 'system/modules/tags/modules/ModuleFaqListTags.php',
Expand Down
1 change: 1 addition & 0 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
$GLOBALS['FE_MOD']['news']['newslist'] = 'ModuleNewsListTags';
$GLOBALS['FE_MOD']['news']['newsarchive'] = 'ModuleNewsArchiveTags';
$GLOBALS['FE_MOD']['news']['newsreader'] = 'ModuleNewsReaderTags';
$GLOBALS['FE_MOD']['events']['calendar'] = 'ModuleCalendarTags';
$GLOBALS['FE_MOD']['events']['eventlist'] = 'ModuleEventlistTags';
$GLOBALS['FE_MOD']['events']['eventreader'] = 'ModuleEventReaderTags';
$GLOBALS['FE_MOD']['faq']['faqlist'] = 'ModuleFaqListTags';
Expand Down
46 changes: 46 additions & 0 deletions modules/ModuleCalendarTags.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

/**
* Contao Open Source CMS
*
* Copyright (c) 2005-2015 Leo Feyer
*
* @license LGPL-3.0+
*/

namespace Contao;


/**
* Front end module "calendar".
*
* @author Leo Feyer <https://github.com/leofeyer>
*/
class ModuleCalendarTags extends \ModuleCalendar
{

/**
* Return all weeks of the current month as array
*
* @return array
*/
protected function compileWeeks()
{
$arrDays = parent::compileWeeks();
$helper = new \TagHelper();
foreach ($arrDays as $strWeekClass => $week)
{
foreach ($week as $i => $event)
{
foreach ($event['events'] as $eventindex => $vv)
{
$tagsandlist = $helper->getTagsAndTaglistForIdAndTable($vv['id'], 'tl_calendar_events', $this->jumpTo);
$vv['tags'] = $tagsandlist['tags'];
$vv['taglist'] = $tagsandlist['taglist'];
$arrDays[$strWeekClass][$i]['events'][$eventindex] = $vv;
}
}
}
return $arrDays;
}
}

0 comments on commit fc0fea4

Please sign in to comment.