?
Referenced as Related to: # 16612
avatar infograf768
infograf768
1 Nov 2016

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)"
screen shot 2016-11-01 at 18 03 59

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?

avatar infograf768 infograf768 - open - 1 Nov 2016
avatar joomla-cms-bot joomla-cms-bot - change - 1 Nov 2016
Labels Added: ?
avatar Hackwar
Hackwar - comment - 1 Nov 2016

What are you expecting to see?

avatar brianteeman
brianteeman - comment - 1 Nov 2016

Sounds normal to me. Does this happen in a monolingual site. Did this happen before

avatar infograf768
infograf768 - comment - 2 Nov 2016

@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 at issues.joomla.org/tracker/joomla-cms/12687.

avatar brianteeman
brianteeman - comment - 2 Nov 2016

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/

avatar brianteeman brianteeman - change - 2 Nov 2016
Status New Information Required
avatar brianteeman
brianteeman - comment - 8 Nov 2016

@infograf768 can we close this? So far it sounds like expected behaviour.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12687.

avatar brianteeman
brianteeman - comment - 10 Nov 2016

I am closing this at this time - it can always be reopened if updated


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12687.

avatar brianteeman brianteeman - change - 10 Nov 2016
Status Information Required Closed
Closed_Date 0000-00-00 00:00:00 2016-11-10 14:18:21
Closed_By brianteeman
avatar brianteeman brianteeman - close - 10 Nov 2016
avatar brianteeman brianteeman - close - 10 Nov 2016
avatar infograf768
infograf768 - comment - 11 Nov 2016

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.

avatar brianteeman
brianteeman - comment - 11 Nov 2016

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.

avatar infograf768
infograf768 - comment - 11 Nov 2016

"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.

avatar brianteeman
brianteeman - comment - 11 Nov 2016

It is nothing to do with the router.

avatar infograf768
infograf768 - comment - 11 Nov 2016

Maybe. It is still an issue. I reopen it.

avatar infograf768
infograf768 - comment - 11 Nov 2016

if github lets me

avatar infograf768 infograf768 - change - 11 Nov 2016
Title
Router issue?
Edit article gets Create Article menu item Title
avatar infograf768 infograf768 - edited - 11 Nov 2016
avatar infograf768 infograf768 - change - 11 Nov 2016
Title
Router issue?
Edit article gets Create Article menu item Title
avatar Bakual Bakual - change - 11 Nov 2016
Status Closed New
Closed_Date 2016-11-10 14:18:20
Closed_By brianteeman
avatar Bakual Bakual - reopen - 11 Nov 2016
avatar Bakual Bakual - reopen - 11 Nov 2016
avatar infograf768
infograf768 - comment - 11 Nov 2016

Correction: not special to multilingual.

in fact we have a regression here as the issue is NOT present on a 3.6.4

avatar infograf768
infograf768 - comment - 11 Nov 2016

and it is a router change issue...
@Hackwar
Can you look at this please. The issue is not present in 3.6.4 (multilingual or not).

avatar infograf768 infograf768 - change - 11 Nov 2016
Title
Edit article gets Create Article menu item Title
Router Change: Edit article gets Create Article menu item Title (small regression)
avatar infograf768 infograf768 - edited - 11 Nov 2016
avatar infograf768 infograf768 - change - 11 Nov 2016
Title
Edit article gets Create Article menu item Title
Router Change: Edit article gets Create Article menu item Title (small regression)
avatar brianteeman
brianteeman - comment - 11 Nov 2016

I still dont see the change from 3.6.4 - see this video
Page title not displayed when editing a blog article
Page title displayed when submitting an article

title

avatar infograf768
infograf768 - comment - 11 Nov 2016

3.6.4
364
3.7.0
370

avatar brianteeman
brianteeman - comment - 11 Nov 2016

Weird

avatar brianteeman
brianteeman - comment - 11 Nov 2016

I have retested with modern router enabled - still no change to my video

avatar Bakual
Bakual - comment - 11 Nov 2016

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?

avatar infograf768
infograf768 - comment - 11 Nov 2016

test sample data has indeed another create article menu item in the user menu

avatar brianteeman
brianteeman - comment - 11 Nov 2016

Yes that was it. I deleted the other menu item for submit articles and I now get the behaviour you describe

avatar infograf768
infograf768 - comment - 11 Nov 2016

my concerns:
1. this also happens when sef is off
2. Could this flaw have an impact elsewhere than article edit, including 3pd

avatar Hackwar
Hackwar - comment - 12 Nov 2016
  1. Yes, since the code to select the right menu item is always the same
  2. No, since this only affects those extensions that use JComponentRouterView-based routers and yes, it will affect all those links that have erronously had no itemid up till now.

This is still expected behavior.

avatar ggppdk
ggppdk - comment - 12 Nov 2016

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;

  • every view has its own criteria
  • if current menu is not a good match, then e.g. menu title and a couple of other things will not be used either
avatar infograf768
infograf768 - comment - 12 Nov 2016

Can't we just change the code somewhere and get the itemid of the page of the article edited?
As demonstrated above and checked by @Bakual this is a regression and I do not expect it to be "normal"

avatar Hackwar
Hackwar - comment - 12 Nov 2016

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.

avatar infograf768
infograf768 - comment - 12 Nov 2016

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...

avatar ggppdk
ggppdk - comment - 12 Nov 2016

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

avatar Hackwar
Hackwar - comment - 12 Nov 2016

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.

avatar ggppdk
ggppdk - comment - 12 Nov 2016

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

avatar Hackwar
Hackwar - comment - 12 Nov 2016

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.

avatar Hackwar
Hackwar - comment - 12 Nov 2016

All of those examples are valid examples where the view should simply follow what the menu item dictates.

avatar infograf768
infograf768 - comment - 12 Nov 2016

deleted former post as it did not take care of Creating a new article... grrr

avatar infograf768
infograf768 - comment - 12 Nov 2016

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

screen shot 2016-11-12 at 11 38 24

EDIT: simplified code

avatar infograf768
infograf768 - comment - 12 Nov 2016

What do you think?

avatar mbabker
mbabker - comment - 12 Nov 2016

Negative. You are hardcoding the page title in your else portion of that statement based on if the item has an existing ID.

avatar ggppdk
ggppdk - comment - 12 Nov 2016

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

avatar ggppdk
ggppdk - comment - 12 Nov 2016

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

avatar Hackwar
Hackwar - comment - 12 Nov 2016

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.

avatar Bakual
Bakual - comment - 12 Nov 2016

@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.

avatar brianteeman brianteeman - change - 13 Nov 2016
Status New Confirmed
avatar brianteeman brianteeman - change - 13 Nov 2016
Category Router / SEF
avatar rvbgnu
rvbgnu - comment - 3 Jun 2017

Hi @Bakual and @Hackwar , is this iisue fixed by #13228 ?
@nibra

avatar franz-wohlkoenig franz-wohlkoenig - change - 3 Jun 2017
Status Confirmed Information Required
avatar Bakual
Bakual - comment - 18 Jun 2017

Cab you test #16756 ?

avatar Bakual
Bakual - comment - 18 Jun 2017

Closing as we have a PR

avatar Bakual Bakual - change - 18 Jun 2017
Status Information Required Closed
Closed_Date 0000-00-00 00:00:00 2017-06-18 21:38:27
Closed_By Bakual
avatar Bakual Bakual - close - 18 Jun 2017

Add a Comment

Login with GitHub to post a comment