Quantcast
Channel: Joomla! Forum - community, help and support
Viewing all articles
Browse latest Browse all 2110

Migrating and Upgrading to Joomla! 5.x • Language Module does not work as intended.

$
0
0
Hello,
Our team has tried to upgrade from Joomla 3 to Joomla 5, but some unexpected errors have occured. The overall functionality of our site still works, but the topbar component which includes a search component and the possibility to switch between languages is no longer visible. See attachments. The old version is how it should look and still looks on Joomla 3 and the new version is how it currently looks on Joomla 5, which is not the way we want it to look. Joomla 5 shows a warning concerning some override files for the templates. There seems to be 3 php files which have override files linked to them. Maybe someone has had a similar problem before and could tell me whether I have to make any changes to the files themselves or change something in the Joomla dashboard. All 3 files are found in the templates/.../html/mod_menu folder of my website.
The following is the original default.php which is currently present in Joomla 3:

Code:

<?php/** * @package     Joomla.Site * @subpackage  mod_menu * * @copyright   Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved. * @license     GNU General Public License version 2 or later; see LICENSE.txt */defined('_JEXEC') or die;$id = '';if ($tagId = $params->get('tag_id', '')){$id = ' id="' . $tagId . '"';}// The menu class is deprecated. Use nav instead?><ul class="nav menu<?php echo $class_sfx; ?> mod-list"<?php echo $id; ?>><?php foreach ($list as $i => &$item){$class = 'item-' . $item->id;if ($item->id == $default_id){$class .= ' default';}if ($item->id == $active_id || ($item->type === 'alias' && $item->params->get('aliasoptions') == $active_id)){$class .= ' current';}if (in_array($item->id, $path)){$class .= ' active';}elseif ($item->type === 'alias'){$aliasToId = $item->params->get('aliasoptions');if (count($path) > 0 && $aliasToId == $path[count($path) - 1]){$class .= ' active';}elseif (in_array($aliasToId, $path)){$class .= ' alias-parent-active';}}if ($item->type === 'separator'){$class .= ' divider';}if ($item->deeper){$class .= ' deeper';}if ($item->parent){$class .= ' parent';}echo '<li class="' . $class . '">';switch ($item->type) :case 'separator':case 'component':case 'heading':case 'url':require JModuleHelper::getLayoutPath('mod_menu', 'default_' . $item->type);break;default:require JModuleHelper::getLayoutPath('mod_menu', 'default_url');break;endswitch;// The next item is deeper.if ($item->deeper){echo '<ul class="nav-child unstyled small">';}// The next item is shallower.elseif ($item->shallower){echo '</li>';echo str_repeat('</ul></li>', $item->level_diff);}// The next item is on the same level.else{echo '</li>';}}?></ul>
This is the corresponding override file:

Code:

<?php/** * @package     Joomla.Site * @subpackage  mod_menu * * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license     GNU General Public License version 2 or later; see LICENSE.txt */defined('_JEXEC') or die;use Joomla\CMS\Helper\ModuleHelper;/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */$wa = $app->getDocument()->getWebAssetManager();$wa->registerAndUseScript('mod_menu', 'mod_menu/menu.min.js', [], ['type' => 'module']);$id = '';if ($tagId = $params->get('tag_id', '')) {    $id = ' id="' . $tagId . '"';}// The menu class is deprecated. Use mod-menu instead?><ul<?php echo $id; ?> class="mod-menu mod-list nav" <?php echo $class_sfx; ?>"><?php foreach ($list as $i => &$item) {    $itemParams = $item->getParams();    $class      = 'nav-item item-' . $item->id;    if ($item->id == $default_id) {        $class .= ' default';    }    if ($item->id == $active_id || ($item->type === 'alias' && $itemParams->get('aliasoptions') == $active_id)) {        $class .= ' current';    }    if (in_array($item->id, $path)) {        $class .= ' active';    } elseif ($item->type === 'alias') {        $aliasToId = $itemParams->get('aliasoptions');        if (count($path) > 0 && $aliasToId == $path[count($path) - 1]) {            $class .= ' active';        } elseif (in_array($aliasToId, $path)) {            $class .= ' alias-parent-active';        }    }    if ($item->type === 'separator') {        $class .= ' divider';    }    if ($item->deeper) {        $class .= ' deeper';    }    if ($item->parent) {        $class .= ' parent';    }    echo '<li class="' . $class . '">';    switch ($item->type) :        case 'separator':        case 'component':        case 'heading':        case 'url':            require ModuleHelper::getLayoutPath('mod_menu', 'default_' . $item->type);            break;        default:            require ModuleHelper::getLayoutPath('mod_menu', 'default_url');            break;    endswitch;    // The next item is deeper.    if ($item->deeper) {        echo '<ul class="mod-menu__sub list-unstyled small">';    } elseif ($item->shallower) {        // The next item is shallower.        echo '</li>';        echo str_repeat('</ul></li>', $item->level_diff);    } else {        // The next item is on the same level.        echo '</li>';    }}?></ul>
Then the file default_url.php:

Code:

<?php/** * @package     Joomla.Site * @subpackage  mod_menu * * @copyright   Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved. * @license     GNU General Public License version 2 or later; see LICENSE.txt */defined('_JEXEC') or die;$attributes = array();if ($item->anchor_title){$attributes['title'] = $item->anchor_title;}if ($item->anchor_css){$attributes['class'] = $item->anchor_css;}if ($item->anchor_rel){$attributes['rel'] = $item->anchor_rel;}$linktype = $item->title;if ($item->menu_image){if ($item->menu_image_css){$image_attributes['class'] = $item->menu_image_css;$linktype = JHtml::_('image', $item->menu_image, $item->title, $image_attributes);}else{$linktype = JHtml::_('image', $item->menu_image, $item->title);}if ($item->params->get('menu_text', 1)){$linktype .= '<span class="image-title">' . $item->title . '</span>';}}if ($item->browserNav == 1){$attributes['target'] = '_blank';$attributes['rel'] = 'noopener noreferrer';if ($item->anchor_rel == 'nofollow'){$attributes['rel'] .= ' nofollow';}}elseif ($item->browserNav == 2){$options = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,' . $params->get('window_open');$attributes['onclick'] = "window.open(this.href, 'targetWindow', '" . $options . "'); return false;";}echo JHtml::_('link', JFilterOutput::ampReplace(htmlspecialchars($item->flink, ENT_COMPAT, 'UTF-8', false)), $linktype, $attributes);
and its override file:

Code:

<?php/** * @package     Joomla.Site * @subpackage  mod_menu * * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license     GNU General Public License version 2 or later; see LICENSE.txt */defined('_JEXEC') or die;use Joomla\CMS\HTML\HTMLHelper;use Joomla\Filter\OutputFilter;$attributes = [];if ($item->anchor_title) {    $attributes['title'] = $item->anchor_title;}if ($item->anchor_css) {    $attributes['class'] = $item->anchor_css;}if ($item->anchor_rel) {    $attributes['rel'] = $item->anchor_rel;}$linktype = $item->title;if ($item->menu_icon) {    // The link is an icon    if ($itemParams->get('menu_text', 1)) {        // If the link text is to be displayed, the icon is added with aria-hidden        $linktype = '<span class="p-2 ' . $item->menu_icon . '" aria-hidden="true"></span>' . $item->title;    } else {        // If the icon itself is the link, it needs a visually hidden text        $linktype = '<span class="p-2 ' . $item->menu_icon . '" aria-hidden="true"></span><span class="visually-hidden">' . $item->title . '</span>';    }} elseif ($item->menu_image) {    // The link is an image, maybe with an own class    $image_attributes = [];    if ($item->menu_image_css) {        $image_attributes['class'] = $item->menu_image_css;    }    $linktype = HTMLHelper::_('image', $item->menu_image, $item->title, $image_attributes);    if ($itemParams->get('menu_text', 1)) {        $linktype .= '<span class="image-title">' . $item->title . '</span>';    }}if ($item->browserNav == 1) {    $attributes['target'] = '_blank';    $attributes['rel'] = 'noopener noreferrer';    if ($item->anchor_rel == 'nofollow') {        $attributes['rel'] .= ' nofollow';    }} elseif ($item->browserNav == 2) {    $options = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,' . $params->get('window_open');    $attributes['onclick'] = "window.open(this.href, 'targetWindow', '" . $options . "'); return false;";}echo HTMLHelper::_('link', OutputFilter::ampReplace(htmlspecialchars($item->flink, ENT_COMPAT, 'UTF-8', false)), $linktype, $attributes);
And default_component.php:

Code:

<?php/** * @package     Joomla.Site * @subpackage  mod_menu * * @copyright   Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved. * @license     GNU General Public License version 2 or later; see LICENSE.txt */defined('_JEXEC') or die;$attributes = array();if ($item->anchor_title){$attributes['title'] = $item->anchor_title;}if ($item->anchor_css){$attributes['class'] = $item->anchor_css;}if ($item->anchor_rel){$attributes['rel'] = $item->anchor_rel;}$linktype = $item->title;if ($item->menu_image){if ($item->menu_image_css){$image_attributes['class'] = $item->menu_image_css;$linktype = JHtml::_('image', $item->menu_image, $item->title, $image_attributes);}else{$linktype = JHtml::_('image', $item->menu_image, $item->title);}if ($item->params->get('menu_text', 1)){$linktype .= '<span class="image-title">' . $item->title . '</span>';}}if ($item->browserNav == 1){$attributes['target'] = '_blank';}elseif ($item->browserNav == 2){$options = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes';$attributes['onclick'] = "window.open(this.href, 'targetWindow', '" . $options . "'); return false;";}echo JHtml::_('link', JFilterOutput::ampReplace(htmlspecialchars($item->flink, ENT_COMPAT, 'UTF-8', false)), $linktype, $attributes);
and its override file:

Code:

<?php/** * @package     Joomla.Site * @subpackage  mod_menu * * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license     GNU General Public License version 2 or later; see LICENSE.txt */defined('_JEXEC') or die;use Joomla\CMS\HTML\HTMLHelper;use Joomla\Filter\OutputFilter;$attributes = [];if ($item->anchor_title) {    $attributes['title'] = $item->anchor_title;}if ($item->anchor_css) {    $attributes['class'] = $item->anchor_css;}if ($item->anchor_rel) {    $attributes['rel'] = $item->anchor_rel;}if ($item->id == $active_id) {    $attributes['aria-current'] = 'location';    if ($item->current) {        $attributes['aria-current'] = 'page';    }}$linktype = $item->title;if ($item->menu_icon) {    // The link is an icon    if ($itemParams->get('menu_text', 1)) {        // If the link text is to be displayed, the icon is added with aria-hidden        $linktype = '<span class="p-2 ' . $item->menu_icon . '" aria-hidden="true"></span>' . $item->title;    } else {        // If the icon itself is the link, it needs a visually hidden text        $linktype = '<span class="p-2 ' . $item->menu_icon . '" aria-hidden="true"></span><span class="visually-hidden">' . $item->title . '</span>';    }} elseif ($item->menu_image) {    // The link is an image, maybe with its own class    $image_attributes = [];    if ($item->menu_image_css) {        $image_attributes['class'] = $item->menu_image_css;    }    $linktype = HTMLHelper::_('image', $item->menu_image, $item->title, $image_attributes);    if ($itemParams->get('menu_text', 1)) {        $linktype .= '<span class="image-title">' . $item->title . '</span>';    }}if ($item->browserNav == 1) {    $attributes['target'] = '_blank';} elseif ($item->browserNav == 2) {    $options = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes';    $attributes['onclick'] = "window.open(this.href, 'targetWindow', '" . $options . "'); return false;";}echo HTMLHelper::_('link', OutputFilter::ampReplace(htmlspecialchars($item->flink, ENT_COMPAT, 'UTF-8', false)), $linktype, $attributes);
I feel like there might be an issue with these files, however I do not quite understand why Joomla overrides only these 3 files.

Any help would be highly appreciated. If there is any more information I should provide, please let me know.
Thank you!

Kind regards
Leonard

Statistics: Posted by richertziaaeu — Tue May 14, 2024 11:21 am



Viewing all articles
Browse latest Browse all 2110

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>