Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.2] Multilang: Remove restrictions for home language menu items #3248

Closed
jgerman-bot opened this issue Aug 19, 2024 · 1 comment · Fixed by #3249
Closed

[5.2] Multilang: Remove restrictions for home language menu items #3248

jgerman-bot opened this issue Aug 19, 2024 · 1 comment · Fixed by #3249

Comments

@jgerman-bot
Copy link

New language relevant PR in upstream repo: joomla/joomla-cms#43862 Here are the upstream changes:

Click to expand the diff!
diff --git a/administrator/components/com_languages/tmpl/multilangstatus/default.php b/administrator/components/com_languages/tmpl/multilangstatus/default.php
index 58734a05f8965..8c11150253d8c 100644
--- a/administrator/components/com_languages/tmpl/multilangstatus/default.php
+++ b/administrator/components/com_languages/tmpl/multilangstatus/default.php
@@ -55,13 +55,6 @@
                 <?php endif; ?>
             <?php endforeach; ?>
         <?php endif; ?>
-        <?php if ($this->defaultHome == true) : ?>
-            <div class="alert alert-warning">
-                <span class="icon-exclamation-triangle" aria-hidden="true"></span>
-                <span class="visually-hidden"><?php echo Text::_('WARNING'); ?></span>
-                <?php echo Text::_('COM_LANGUAGES_MULTILANGSTATUS_DEFAULT_HOME_MODULE_PUBLISHED'); ?>
-            </div>
-        <?php endif; ?>
         <?php foreach ($this->statuses as $status) : ?>
             <?php // Displays error when Site language and Content language are published but Home page is unpublished, trashed or missing. ?>
             <?php if ($status->lang_code && $status->published == 1 && $status->home_published != 1) : ?>
diff --git a/administrator/components/com_menus/presets/alternate.xml b/administrator/components/com_menus/presets/alternate.xml
index ab129265fbe52..3f2a69d0b8d9f 100644
--- a/administrator/components/com_menus/presets/alternate.xml
+++ b/administrator/components/com_menus/presets/alternate.xml
@@ -225,11 +225,11 @@
 			type="separator"
 			title="JSITE"
 			hidden="false"
-			sql_select="a.id, a.title, a.menutype, CASE COALESCE(SUM(m.home), 0) WHEN 0 THEN '' WHEN 1 THEN CASE m.language WHEN '*' THEN 'class:icon-home' ELSE CONCAT('image:', l.lang_code) END ELSE 'image:mod_languages/icon-16-language.png' END AS icon"
+			sql_select="a.id, a.title, a.menutype, CASE COALESCE(SUM(m.home), 0) WHEN 0 THEN '' WHEN 1 THEN CASE MAX(m.language) WHEN '*' THEN 'class:icon-home' ELSE CONCAT('image:', MAX(l.lang_code)) END ELSE 'class:icon-home' END AS icon"
 			sql_from="#__menu_types AS a"
 			sql_where="a.client_id = 0"
 			sql_leftjoin="#__menu AS m ON m.menutype = a.menutype AND m.home = 1 LEFT JOIN #__languages AS l ON l.lang_code = m.language"
-			sql_group="a.id, a.title, a.menutype, m.language, l.lang_code"
+			sql_group="a.id, a.title, a.menutype"
 			sql_order="a.id DESC"
 			>
 			<menuitem
diff --git a/administrator/components/com_menus/presets/default.xml b/administrator/components/com_menus/presets/default.xml
index d67d96b4cebbd..2683557626ce5 100644
--- a/administrator/components/com_menus/presets/default.xml
+++ b/administrator/components/com_menus/presets/default.xml
@@ -136,11 +136,11 @@
 			type="separator"
 			title="JSITE"
 			hidden="false"
-			sql_select="a.id, a.title, a.menutype, CASE COALESCE(SUM(m.home), 0) WHEN 0 THEN '' WHEN 1 THEN CASE m.language WHEN '*' THEN 'class:icon-home' ELSE CONCAT('image:', l.lang_code) END ELSE 'image:mod_languages/icon-16-language.png' END AS icon"
+			sql_select="a.id, a.title, a.menutype, CASE COALESCE(SUM(m.home), 0) WHEN 0 THEN '' WHEN 1 THEN CASE MAX(m.language) WHEN '*' THEN 'class:icon-home' ELSE CONCAT('image:', MAX(l.lang_code)) END ELSE 'class:icon-home' END AS icon"
 			sql_from="#__menu_types AS a"
 			sql_where="a.client_id = 0"
 			sql_leftjoin="#__menu AS m ON m.menutype = a.menutype AND m.home = 1 LEFT JOIN #__languages AS l ON l.lang_code = m.language"
-			sql_group="a.id, a.title, a.menutype, m.language, l.lang_code"
+			sql_group="a.id, a.title, a.menutype"
 			sql_order="a.ordering ASC"
 			>
 			<menuitem
diff --git a/administrator/language/en-GB/com_languages.ini b/administrator/language/en-GB/com_languages.ini
index b9fcefd3705e5..d884629f85357 100644
--- a/administrator/language/en-GB/com_languages.ini
+++ b/administrator/language/en-GB/com_languages.ini
@@ -70,6 +70,7 @@ COM_LANGUAGES_MULTILANGSTATUS_CONTENT_LANGUAGE_PUBLISHED="Published Content Lang
 COM_LANGUAGES_MULTILANGSTATUS_CONTENT_LANGUAGE_SEF_MISSING="The \"URL Language Code\" is missing for the <strong>%s</strong> Content Language. <strong>The multilingual feature may not function properly or the site may not be reachable!</strong>"
 COM_LANGUAGES_MULTILANGSTATUS_CONTENT_LANGUAGE_TRASHED="The <strong>%s</strong> Content Language is trashed. <strong>The language will not display on the site.</strong>"
 COM_LANGUAGES_MULTILANGSTATUS_CONTENT_TABLE_CAPTION="Content Language Status"
+; The following string is deprecated and will be removed with 7.0
 COM_LANGUAGES_MULTILANGSTATUS_DEFAULT_HOME_MODULE_PUBLISHED="The menu module displaying the Home menu item set to language &quot;All&quot; should not be published."
 COM_LANGUAGES_MULTILANGSTATUS_ERROR_CONTENT_LANGUAGE="A Default Home page is assigned to the <strong>%s</strong> Content Language although a Site Language for this Content Language is not installed or enabled AND/OR the Content Language is not published. <strong>The language will not display on the site.</strong>"
 COM_LANGUAGES_MULTILANGSTATUS_ERROR_DEFAULT_CONTENT_LANGUAGE="The Content Language for the <strong>%s</strong> default Site Language is unpublished or does not exist. <strong>The multilingual feature may not function properly or the site may not be reachable!</strong>"
diff --git a/libraries/src/Table/Menu.php b/libraries/src/Table/Menu.php
index c035ef32006d1..7a25206aaa439 100644
--- a/libraries/src/Table/Menu.php
+++ b/libraries/src/Table/Menu.php
@@ -258,22 +258,6 @@ public function store($updateNulls = true)
         }
 
         if ($this->home == '1') {
-            // Verify that the home page for this menu is unique.
-            if (
-                $table->load(
-                    [
-                    'menutype'  => $this->menutype,
-                    'client_id' => (int) $this->client_id,
-                    'home'      => '1',
-                    ]
-                )
-                && ($table->language != $this->language)
-            ) {
-                $this->setError(Text::_('JLIB_DATABASE_ERROR_MENU_HOME_NOT_UNIQUE_IN_MENU'));
-
-                return false;
-            }
-
             // Verify that the home page for this language is unique per client id
             if ($table->load(['home' => '1', 'language' => $this->language, 'client_id' => (int) $this->client_id])) {
                 if ($table->checked_out && $table->checked_out != $this->checked_out) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment