? ? Pending

User tests: Successful: Unsuccessful:

avatar infograf768
infograf768
28 Dec 2017

Pull Request for Issue #19192

Summary of Changes

Patch similar to #12167
Limited to com_content

Steps to reproduce the issue

Create a menu item with the title "Categories" that lists all the categories, when accessing the menu, the page title in the browser shows "Categories" and if I click on any category the browser title does not change.

Expected result

When accessing a category of the list, the title of the category should be displayed in the browser.

Actual result

When accessing a category of the list it continues to show the menu title instead of the title of the category that has been selected .

After patch

The category title will display
Example:
screen shot 2017-12-28 at 10 06 35

Documentation Changes Required

avatar infograf768 infograf768 - open - 28 Dec 2017
avatar infograf768 infograf768 - change - 28 Dec 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 28 Dec 2017
Category Front End com_content
avatar infograf768
infograf768 - comment - 28 Dec 2017

Although this can be useful, it looks like it does not really solve #19192

avatar infograf768
infograf768 - comment - 28 Dec 2017

@Bakual
It looks like we do get the correct $title with the PR (did a var_dump line 219), but that the Head is reloaded and displays the former menu title.

avatar joomdonation
joomdonation - comment - 28 Dec 2017

@infograf768 The page title is set again in parent class, see https://github.com/joomla/joomla-cms/blob/staging/libraries/src/MVC/View/CategoryView.php#L271

So if you want to set title, instead of calling

$this->document->setTitle($title);

You need to call

 $this->params->set('page_title', $title);

However, I think the logic is more complicated than that. If the active menu item is linked to current category, then page title setting from menu item should be used instead of hard code to category title

(just comment base on quick look at the code, so I might be wrong)

avatar infograf768
infograf768 - comment - 28 Dec 2017

tks, will look later on.

avatar infograf768 infograf768 - change - 28 Dec 2017
Labels Added: ?
avatar infograf768
infograf768 - comment - 28 Dec 2017

@joomdonation
By checking for view=categories&id= I got sure the category name is only displayed when there is no specific menu item for that category.
Below, Fruit Shop Site, has no menu item.
cat_title

avatar infograf768 infograf768 - change - 28 Dec 2017
Title
Display category title as page heading when no menu item for com_content category
Display category title as page heading and page title when no menu item for com_content category
avatar infograf768 infograf768 - edited - 28 Dec 2017
avatar segundochinguel
segundochinguel - comment - 28 Dec 2017

@infograf768
I saw the gif and it does exactly what I was looking for. I have not implemented it yet, but I trust that was the solution. I had trying to overwrite view.html.php in category, but without results. You may not close the case until you try it in a few hours.

avatar infograf768
infograf768 - comment - 29 Dec 2017
avatar segundochinguel segundochinguel - test_item - 29 Dec 2017 - Tested successfully
avatar segundochinguel
segundochinguel - comment - 29 Dec 2017

I have tested this item successfully on 2c1afba


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

avatar Quy Quy - test_item - 9 Jan 2018 - Tested successfully
avatar Quy
Quy - comment - 9 Jan 2018

I have tested this item successfully on 2c1afba


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

avatar Quy Quy - change - 9 Jan 2018
Status Pending Ready to Commit
avatar Quy
Quy - comment - 9 Jan 2018

RTC

avatar joomdonation
joomdonation - comment - 9 Jan 2018

If it is possible, I think the code should be changed to:

if ($menu
	&& $menu->component == 'com_content'
	&& isset($menu->query['view'], $menu->query['id'])
	&& $menu->query['view'] == 'category'
	&& $menu->query['id'] == $this->category->id)
{
	$this->params->def('page_heading', $this->params->get('page_title', $menu->title));
	$title = $this->params->get('page_title', $menu->title);
}
else
{
	$this->params->def('page_heading', $this->category->title);
	$title = $this->category->title;
	$this->params->set('page_title', $title);
}

Look a bit longer but it clearly show that the if block is for case current menu item is direct link to the current displayed category.

avatar segundochinguel
segundochinguel - comment - 9 Jan 2018

@joomdonation, I tried this code correctly.

Now, I guess this replaces the previously accepted code.

avatar infograf768 infograf768 - change - 10 Jan 2018
Labels Added: ?
avatar infograf768
infograf768 - comment - 10 Jan 2018

Modified to use @joomdonation proposal. Indeed looks cleaner. 👍
@segundochinguel
@Quy
Please test and mark OK on https://issues.joomla.org/tracker/joomla-cms/19195

avatar Quy Quy - test_item - 10 Jan 2018 - Tested successfully
avatar Quy
Quy - comment - 10 Jan 2018

I have tested this item successfully on e72d97a


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

avatar infograf768 infograf768 - alter_testresult - 11 Jan 2018 - segundochinguel: Tested successfully
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 14 Jan 2018

Ready to Commit after two successful tests.

avatar mbabker mbabker - change - 15 Jan 2018
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2018-01-15 15:05:46
Closed_By mbabker
avatar mbabker mbabker - close - 15 Jan 2018
avatar mbabker mbabker - merge - 15 Jan 2018

Add a Comment

Login with GitHub to post a comment