Skip to content

Commit

Permalink
Always use the regular icon if page type has no icon (see #1650)
Browse files Browse the repository at this point in the history
Description
-----------

Preparing for #1516: I very much doubt every developer wants to provide a custom icon for a custom page type.

Currently, extensions (most likely) copy their images into the core's theme folder (e.g. [folderpage](https://github.com/terminal42/contao-folderpage) does that). But that shouldn't be used, people should use the hook to override the icon and provide their own path.

Commits
-------

a1c2837 Always use the regular icon if page type has no icon
  • Loading branch information
aschempp committed May 18, 2020
1 parent 96cc235 commit e7e0054
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,8 @@ protected function getSpellcheckerString()
public static function getPageStatusIcon($objPage)
{
$sub = 0;
$image = $objPage->type . '.svg';
$type = \in_array($objPage->type, array('regular', 'root', 'forward', 'redirect', 'error_401', 'error_403', 'error_404'), true) ? $objPage->type : 'regular';
$image = $type . '.svg';

// Page not published or not active
if (!$objPage->published || ($objPage->start != '' && $objPage->start > time()) || ($objPage->stop != '' && $objPage->stop < time()))
Expand All @@ -690,21 +691,21 @@ public static function getPageStatusIcon($objPage)
}

// Page hidden from menu
if ($objPage->hide && !\in_array($objPage->type, array('root', 'error_401', 'error_403', 'error_404')))
if ($objPage->hide && !\in_array($type, array('root', 'error_401', 'error_403', 'error_404')))
{
$sub += 2;
}

// Page protected
if ($objPage->protected && !\in_array($objPage->type, array('root', 'error_401', 'error_403', 'error_404')))
if ($objPage->protected && !\in_array($type, array('root', 'error_401', 'error_403', 'error_404')))
{
$sub += 4;
}

// Get the image name
if ($sub > 0)
{
$image = $objPage->type . '_' . $sub . '.svg';
$image = $type . '_' . $sub . '.svg';
}

// HOOK: add custom logic
Expand Down

0 comments on commit e7e0054

Please sign in to comment.