Tested on multilingual site:
Create a menu item of type Create Article tagged to a specific language.
Log and edit in frontend an article in the same language.
I get here the title of the Create Article menu item over the article I am editing.
In this screenshot "Create article (English)"
I get this behavior even when SEF if OFF. That menu item Itemid is appended to the edit page.
For example:
http://localhost:8888/index.php?option=com_content&view=form&layout=edit&a_id=7&Itemid=625&catid=8&return=aHR0cDovL2xvY2FsaG9zdDo4ODg4L3Rlc3R3aW5kb3dzL3RydW5rZ2l0bmV3L2luZGV4LnBocD9vcHRpb249Y29tX2NvbnRlbnQmdmlldz1hcnRpY2xlJmlkPTc6d2lsbGlhbS1zaGFrZXNwZWFyZSZjYXRpZD04Jmxhbmc9ZW4mSXRlbWlkPTExMg==&lang=en
@Hackwar
Can you look into this?
Labels |
Added:
?
|
Sounds normal to me. Does this happen in a monolingual site. Did this happen before
I am expecting no title at all, the same as when we do not have a Create Article menu item, as this title is misleading.
Sorry but what is the change in behaviour and what is this to do with
routing
If you have the menu link set to show Page Heading then this happens and
always has
On 2 November 2016 at 10:09, infograf768 notifications@github.com wrote:
@Hackwar https://github.com/Hackwar
I am expecting no title at all, the same as when we do not have a Create
Article menu item, as this title is misleading.
This comment was created with the J!Tracker Application
https://github.com/joomla/jissues at issues.joomla.org/tracker/
joomla-cms/12687.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#12687 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABPH8S4RCisdTKW0ehHzKyV3VH91EbW_ks5q6GFWgaJpZM4KmVZC
.
Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
https://brian.teeman.net/ http://brian.teeman.net/
Status | New | ⇒ | Information Required |
@infograf768 can we close this? So far it sounds like expected behaviour.
I am closing this at this time - it can always be reopened if updated
Status | Information Required | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-11-10 14:18:21 |
Closed_By | ⇒ | brianteeman |
I do not consider this as expected behaviour at all.
When editing an article, one should not have as Title the title of the Create article menu item.
That is the title coming from the menu. It has always been this way as far
as I can remember. If you do not want it then turn it off in the menu.
"It has always been that way..." does not mean it is right.
I may want the Create Menu title to show when I really use that menu item. I do not want it when I edit an article.
This is just plain wrong.
It is nothing to do with the router.
Maybe. It is still an issue. I reopen it.
if github lets me
Title |
|
Title |
|
Status | Closed | ⇒ | New |
Closed_Date | 2016-11-10 14:18:20 | ⇒ | |
Closed_By | brianteeman | ⇒ |
Correction: not special to multilingual.
in fact we have a regression here as the issue is NOT present on a 3.6.4
Title |
|
Title |
|
Weird
I have retested with modern router enabled - still no change to my video
I see where it comes from, but don't know exactly what the change was yet.
In this line: https://github.com/joomla/joomla-cms/blob/staging/libraries/cms/component/router/rules/menu.php#L97 we overwrite the Itemid passed in the URL query with one that is supposed to be a better match.
Usually that likely works fine, but in case of the article edit it isn't really accurate even if the menu item matches view and layout. Personally I think it should look for a match on the ID (a_id
) as well, since it's similar to a single article view. But I don't know that deep enough to know where we could add the id the the lookup.
It may be that in 3.6.4, that lookup did work differently and that explains the difference.
I also don't know why it works different in Brians setup. Maybe there are two "create article" menu items in the sample data and it picks the other one?
test sample data has indeed another create article menu item in the user menu
Yes that was it. I deleted the other menu item for submit articles and I now get the behaviour you describe
my concerns:
1. this also happens when sef is off
2. Could this flaw have an impact elsewhere than article edit, including 3pd
This is still expected behavior.
About 3rd parties, it is as Hackwar said , it is up to their routers to select their appropriate menu items
i have already faced a similar issue
and
in all of my views, i have code to calculate this
$current_menu_matches_current view = yes / no;
Since I've had this discussion now about 20 times, always with the same result that the complaining persons expectations were not the expectations of the general audience, I'm not going to further comment in this discussion. And: No, we can not introduce an exception for the edit view of articles in the com_content component.
How can the expectation of the "general audience" fit here?
You can't be serious saying that the only way to not get the wrong page heading is to never display it for the Create Article menu item...
And: No, we can not introduce an exception for the edit view of articles in the com_content component.
Regardless of changing / improving or not changing the router code,
the view still needs to validate that currently menu item is good match, and thus NOT blindly using things that were not meant for current view
That is called routing and that is exactly what the router is for. The same reason why the breadcrumbs module does not render the component output, JForm does not handle tagging and JView does not handle routing.
There are 2 different topics
1 is making routing optimal selection of menu items
1 is that the view validates if some menu stuff should be used according to some proper criteria, that are specific to the view
I can make a PR about the second, (about the article view / form)
on Monday / Tuesday, this is not urgent or anything,
and see what comments you have about my PR
So, then tell me how the view knows that it should or should not display the title. How should the view behave:
1. The view is called with a menu item that points to such a view
2. The view is called with a menu item that points to a different view of the same component.
3. The view is called with a menu item that points to a different view of a different component.
All of those examples are valid examples where the view should simply follow what the menu item dictates.
deleted former post as it did not take care of Creating a new article... grrr
Ok, here is what I get.
I do not think that edit an article can be obtained by a specific menu item (Tell me if I am wrong).
Therefore we could modify the view: ROOT/components/com_content/views/form/view.html.php
[...]
// Because the application sets a default page title,
// we need to get it from the menu item itself
$menu = $menus->getActive();
$isNew = ($this->get('Item')->id == 0);
if ($menu && $isNew)
{
$this->params->def('page_heading', $this->params->get('page_title', $menu->title));
$title = $this->params->def('page_title', JText::_('COM_CONTENT_FORM_EDIT_ARTICLE'));
}
else
{
$this->params->def('page_heading', JText::_('COM_CONTENT_FORM_EDIT_ARTICLE'));
$title = JText::_('COM_CONTENT_FORM_EDIT_ARTICLE');
}
[...]
The url obtained is still using the Create Article menu item
http://localhost:8888/370/trunkgitnew/index.php/create-a-post?view=form&a_id=3&catid=9&return=aHR0cDovL2xvY2FsaG9zdDo4ODg4LzM3MC90cnVua2dpdG5ldy9pbmRleC5waHA=
and we get
EDIT: simplified code
What do you think?
Negative. You are hardcoding the page title in your else portion of that statement based on if the item has an existing ID.
Negative. You are hardcoding the page title in your else portion of that statement based on if the item has an existing ID.
We are hard coding it already to whatever the current active menu item has, which is even worse
I did not say to use exactly the solution that infograf768 suggested,
maybe i would suggest different checks, still blinding using the page title from the current menu item is problematic
I don't really care what the title is, but I want to point out, that this is not a routing issue and the title should be changed accordingly.
@Hackwar Imho, the Itemid lookup should not return the "create article" menuitem for edits. This could be done by taking care of the a_id
query argument. The "create article" is only a valid Itemid if the a_id
is 0, otherwise it should probably take the Itemid passed in the request since there is no better matching one.
From my understanding that should be possible since we do similar checks for the id
with the article view. I just don't know where that is done with the class router approach. I just saw the array was like form => true
, while I think it should be form => 0
.
Status | New | ⇒ | Confirmed |
Category | ⇒ | Router / SEF |
Status | Confirmed | ⇒ | Information Required |
Closing as we have a PR
Status | Information Required | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-06-18 21:38:27 |
Closed_By | ⇒ | Bakual |
What are you expecting to see?