?
avatar Denitz
Denitz
25 Mar 2021

Steps to reproduce the issue

Enable language debug and create a new admin menu item of "Articles > Create an Article" type.

Expected result

See in menu items list:

**Articles** » **Create An Article**

Actual result

**Articles** » article

System information (as much as possible)

Unrelated

Additional comments

Joomla 3 and 4 affected.

avatar Denitz Denitz - open - 25 Mar 2021
avatar joomla-cms-bot joomla-cms-bot - change - 25 Mar 2021
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 25 Mar 2021
avatar infograf768
infograf768 - comment - 25 Mar 2021

Can't reproduce
J4
Screen Shot 2021-03-25 at 07 17 32

J3
Screen Shot 2021-03-25 at 07 18 20

avatar Denitz
Denitz - comment - 25 Mar 2021

@infograf768 Are you sure you create a menu item in Administrator menu, not in Site?

avatar Denitz Denitz - change - 25 Mar 2021
Title
Backend menu items types not translated
Backend menu item types not translated
avatar Denitz Denitz - edited - 25 Mar 2021
avatar infograf768
infograf768 - comment - 25 Mar 2021

Was in site indeed. Should have read better.
In admin, it looks like what you describe is common to all mernu items. Looking into it.

avatar infograf768
infograf768 - comment - 25 Mar 2021

Please test

diff --git a/administrator/components/com_menus/views/items/view.html.php b/administrator/components/com_menus/views/items/view.html.php
index 9b5a07c..b53cd1c 100644
--- a/administrator/components/com_menus/views/items/view.html.php
+++ b/administrator/components/com_menus/views/items/view.html.php
@@ -157,10 +157,23 @@
 							else
 							{
-								// Get XML file from component folder for standard layouts
-								$file = JPATH_SITE . '/components/' . $item->componentname . '/views/' . $vars['view'] . '/tmpl/' . $vars['layout'] . '.xml';
-
-								if (!file_exists($file))
+								if ($this->state->get('filter.client_id') == 0)
 								{
-									$file = JPATH_SITE . '/components/' . $item->componentname . '/view/' . $vars['view'] . '/tmpl/' . $vars['layout'] . '.xml';
+									// Get XML file from component folder for standard layouts
+									$file = JPATH_SITE . '/components/' . $item->componentname . '/views/' . $vars['view'] . '/tmpl/' . $vars['layout'] . '.xml';
+
+									if (!file_exists($file))
+									{
+										$file = JPATH_SITE . '/components/' . $item->componentname . '/view/' . $vars['view'] . '/tmpl/' . $vars['layout'] . '.xml';
+									}
+								}
+								else
+								{
+									// Get XML file from administrator component folder for standard layouts
+									$file = JPATH_ADMINISTRATOR . '/components/' . $item->componentname . '/views/' . $vars['view'] . '/tmpl/' . $vars['layout'] . '.xml';
+
+									if (!file_exists($file))
+									{
+										$file = JPATH_ADMINISTRATOR . '/components/' . $item->componentname . '/view/' . $vars['view'] . '/tmpl/' . $vars['layout'] . '.xml';
+									}
 								}
 							}

i.e. modify administrator/components/com_menus/views/items/view.html.php from line 159
from

							else
							{
								// Get XML file from component folder for standard layouts
								$file = JPATH_SITE . '/components/' . $item->componentname . '/views/' . $vars['view'] . '/tmpl/' . $vars['layout'] . '.xml';

								if (!file_exists($file))
								{
									$file = JPATH_SITE . '/components/' . $item->componentname . '/view/' . $vars['view'] . '/tmpl/' . $vars['layout'] . '.xml';
								}
							}

to

							else
							{
								if ($this->state->get('filter.client_id') == 0)
								{
									// Get XML file from component folder for standard layouts
									$file = JPATH_SITE . '/components/' . $item->componentname . '/views/' . $vars['view'] . '/tmpl/' . $vars['layout'] . '.xml';

									if (!file_exists($file))
									{
										$file = JPATH_SITE . '/components/' . $item->componentname . '/view/' . $vars['view'] . '/tmpl/' . $vars['layout'] . '.xml';
									}
								}
								else
								{
									// Get XML file from administrator component folder for standard layouts
									$file = JPATH_ADMINISTRATOR . '/components/' . $item->componentname . '/views/' . $vars['view'] . '/tmpl/' . $vars['layout'] . '.xml';

									if (!file_exists($file))
									{
										$file = JPATH_ADMINISTRATOR . '/components/' . $item->componentname . '/view/' . $vars['view'] . '/tmpl/' . $vars['layout'] . '.xml';
									}
								}
							}
avatar Denitz
Denitz - comment - 25 Mar 2021

Templates should be checked as well, maybe this after 143:

							$base = $this->state->get('filter.client_id') == 0 ? JPATH_SITE : JPATH_ADMINISTRATOR;

							// Attempt to load the layout xml file.
							// If Alternative Menu Item, get template folder for layout file
							if (strpos($vars['layout'], ':') > 0)
							{
								// Use template folder for layout file
								$temp = explode(':', $vars['layout']);
								$file = $base . '/templates/' . $temp[0] . '/html/' . $item->componentname . '/' . $vars['view'] . '/' . $temp[1] . '.xml';

								// Load template language file
								$lang->load('tpl_' . $temp[0] . '.sys', $base, null, false, true)
								||	$lang->load('tpl_' . $temp[0] . '.sys', $base . '/templates/' . $temp[0], null, false, true);
							}
							else
							{
								// Get XML file from component folder for standard layouts
								$file = $base . '/components/' . $item->componentname . '/views/' . $vars['view'] . '/tmpl/' . $vars['layout'] . '.xml';

								if (!file_exists($file))
								{
									$file = $base . '/components/' . $item->componentname . '/view/' . $vars['view'] . '/tmpl/' . $vars['layout'] . '.xml';
								}
							}
avatar infograf768
infograf768 - comment - 25 Mar 2021

Templates should be checked as well, maybe this after 143:

Yep. Also use $base in my proposal to simplify.

Can you make PR?

avatar saumyasarkar11
saumyasarkar11 - comment - 25 Mar 2021

I've tried to create this PR as per your instructions stated above. Do let me know your feedback

avatar infograf768
infograf768 - comment - 25 Mar 2021

I did in your PR.

avatar Denitz
Denitz - comment - 25 Mar 2021

The code is wrong

replace original code

							$vars['layout'] = isset($vars['layout']) ? $vars['layout'] : 'default';

							// Attempt to load the layout xml file.
							// If Alternative Menu Item, get template folder for layout file
							if (strpos($vars['layout'], ':') > 0)
							{
								// Use template folder for layout file
								$temp = explode(':', $vars['layout']);
								$file = JPATH_SITE . '/templates/' . $temp[0] . '/html/' . $item->componentname . '/' . $vars['view'] . '/' . $temp[1] . '.xml';

								// Load template language file
								$lang->load('tpl_' . $temp[0] . '.sys', JPATH_SITE, null, false, true)
								||	$lang->load('tpl_' . $temp[0] . '.sys', JPATH_SITE . '/templates/' . $temp[0], null, false, true);
							}
							else
							{
								// Get XML file from component folder for standard layouts
								$file = JPATH_SITE . '/components/' . $item->componentname . '/views/' . $vars['view'] . '/tmpl/' . $vars['layout'] . '.xml';

								if (!file_exists($file))
								{
									$file = JPATH_SITE . '/components/' . $item->componentname . '/view/' . $vars['view'] . '/tmpl/' . $vars['layout'] . '.xml';
								}
							}

with

							$vars['layout'] = isset($vars['layout']) ? $vars['layout'] : 'default';

							$base = $this->state->get('filter.client_id') == 0 ? JPATH_SITE : JPATH_ADMINISTRATOR;

							// Attempt to load the layout xml file.
							// If Alternative Menu Item, get template folder for layout file
							if (strpos($vars['layout'], ':') > 0)
							{
								// Use template folder for layout file
								$temp = explode(':', $vars['layout']);
								$file = $base . '/templates/' . $temp[0] . '/html/' . $item->componentname . '/' . $vars['view'] . '/' . $temp[1] . '.xml';

								// Load template language file
								$lang->load('tpl_' . $temp[0] . '.sys', $base, null, false, true)
								||	$lang->load('tpl_' . $temp[0] . '.sys', $base . '/templates/' . $temp[0], null, false, true);
							}
							else
							{
								// Get XML file from component folder for standard layouts
								$file = $base . '/components/' . $item->componentname . '/views/' . $vars['view'] . '/tmpl/' . $vars['layout'] . '.xml';

								if (!file_exists($file))
								{
									$file = $base . '/components/' . $item->componentname . '/view/' . $vars['view'] . '/tmpl/' . $vars['layout'] . '.xml';
								}
							}
avatar infograf768
infograf768 - comment - 25 Mar 2021

@Denitz

I am in fact wondering about modifying the path when we have an alternative menu item in the site template. It does not look right.

avatar brianteeman
brianteeman - comment - 25 Mar 2021

@Denitz please submit a pull request instead of posting code in a comment

avatar infograf768 infograf768 - change - 26 Mar 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-03-26 08:28:20
Closed_By infograf768
avatar infograf768 infograf768 - close - 26 Mar 2021
avatar infograf768
infograf768 - comment - 26 Mar 2021

Patch #32871
closing

Add a Comment

Login with GitHub to post a comment