Skip to content

Commit

Permalink
[4.0] rework language handling in module emptystate (#34144)
Browse files Browse the repository at this point in the history
* rework language handling in module emptystate

* add isset wrapper
  • Loading branch information
Phil E. Taylor committed May 24, 2021
1 parent 29aa7d5 commit fd7e23c
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions layouts/joomla/content/emptystate_module.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,29 @@

defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;

$textPrefix = $displayData['textPrefix'];
$icon = $displayData['icon'] ?? 'icon-copy article';
$componentLangString = $textPrefix . '_EMPTYSTATE_TITLE';
$moduleLangString = $textPrefix . '_EMPTYSTATE_MODULE_TITLE' . (array_key_exists('textSuffix', $displayData) ? $displayData['textSuffix'] : '');
$moduleTitle = Text::_($moduleLangString);

$title = $displayData['title']
?? ($moduleTitle != $moduleLangString
? Text::_($moduleTitle)
: Text::_($componentLangString));
// Did we have a definitive title provided to the view?
if (isset($displayData['title']))
{
$title = $displayData['title'];
}
// Can we find a *_EMPTYSTATE_MODULE_TITLE translation?
elseif (Factory::getApplication()->getLanguage()->hasKey($moduleLangString))
{
$title = Text::_($moduleLangString);
}
// Else use the components *_EMPTYSTATE_TITLE string.
else
{
$title = Text::_($componentLangString);
}
?>
<div class="mb-4">
<p class="fw-bold text-center text-muted">
Expand Down

0 comments on commit fd7e23c

Please sign in to comment.