User tests: Successful: Unsuccessful:
Pull Request for Issue #19192
Patch similar to #12167
Limited to com_content
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.
When accessing a category of the list, the title of the category should be displayed in the browser.
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 .
The category title will display
Example:
Status | New | ⇒ | Pending |
Category | ⇒ | Front End com_content |
@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)
tks, will look later on.
Labels |
Added:
?
|
@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.
Title |
|
@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.
@segundochinguel
Please mark the PR as successful on https://issues.joomla.org/tracker/joomla-cms/19195
I have tested this item
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
RTC
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.
@joomdonation, I tried this code correctly.
Now, I guess this replaces the previously accepted code.
Labels |
Added:
?
|
Modified to use @joomdonation proposal. Indeed looks cleaner.
@segundochinguel
@Quy
Please test and mark OK on https://issues.joomla.org/tracker/joomla-cms/19195
I have tested this item
Ready to Commit after two successful tests.
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 |
Although this can be useful, it looks like it does not really solve #19192