Skip to content

Commit

Permalink
Only generate messages module if necessary (fixes #1374)
Browse files Browse the repository at this point in the history
  • Loading branch information
aschempp committed Mar 17, 2015
1 parent 80aa99f commit 13463e7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions system/modules/isotope/docs/CHANGELOG-2.2.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Isotope eCommerce Changelog
Version 2.2.3-stable (2015-??-??)
---------------------------------

### Improved
- Only generate messages module if necessary (fixes #1374)

### Fixed
- Gallery watermark positions were not available in Contao 3.4 (#1365)
- Labels for foreignKey fields were not shown in product attribute view (#1389)
Expand Down
19 changes: 19 additions & 0 deletions system/modules/isotope/library/Isotope/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ public static function add($strMessage, $strType)
*/
public static function generate()
{
if (static::isEmpty()) {
return '';
}

$objModule = new Messages(new \ModuleModel());
$objModule->type = 'iso_message';

Expand Down Expand Up @@ -158,6 +162,21 @@ public static function reset()
}
}

/**
* Returns true if there are no messages defined
*
* @return bool
*/
public static function isEmpty()
{
foreach (static::getTypes() as $strType) {
if (!empty($_SESSION[$strType])) {
return false;
}
}

return true;
}

/**
* Return all available message types
Expand Down

0 comments on commit 13463e7

Please sign in to comment.