User tests: Successful: Unsuccessful:
Pull Request for Issue #11215 .
This is just a helper function to allow developers to set the document title according to what options have been set in regards to the "Include Site Name in Page Titles" option from Global Configuration - without the need to duplicate this same logic in every view.
Call $this->setDocumentTitle($title);
in your view's display()
function; for example, this part from /components/com_users/views/login/view.html.php
:
$title = $this->params->get('page_title', '');
if (empty($title))
{
$title = $app->get('sitename');
}
elseif ($app->get('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title);
}
elseif ($app->get('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename'));
}
$this->document->setTitle($title);
Can be simplified into:
$this->setDocumentTitle($this->params->get('page_title', ''));
Same goes for all other components Joomla! is using, since they all duplicate the same code.
Category | ⇒ | Libraries |
Status | New | ⇒ | Pending |
Labels |
Added:
?
|
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
Labels |
Added:
?
|
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-09-18 15:46:18 |
Closed_By | ⇒ | wilsonge |
Labels |
Added:
?
Removed: ? |
I have tested this item✅ successfully on 2c5f131
Tested. Works as it is. No problem found using new helper method setDocumentTitle().
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/11399.