From 94aecc0bc32a0791cabf8c8d855e5a7127c103ad Mon Sep 17 00:00:00 2001 From: Octavian Cinciu Date: Tue, 2 Aug 2016 15:40:50 +0300 Subject: [PATCH 1/2] setDocumentTitle() function in JViewLegacy --- libraries/legacy/view/legacy.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/libraries/legacy/view/legacy.php b/libraries/legacy/view/legacy.php index 9b10c716a73ed..f980956c85877 100644 --- a/libraries/legacy/view/legacy.php +++ b/libraries/legacy/view/legacy.php @@ -827,4 +827,34 @@ public function getForm() return $this->form; } + + /** + * Sets the document title according to Global Configuration options + * + * @param string $title The page title + * + * @return void + * + * @since 3.6 + */ + public function setDocumentTitle($title) + { + $app = JFactory::getApplication(); + + // Check for empty title and add site name if param is set + 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); + } } From 2c5f1313a2cf8b01fafc30c1546d6af8b430ed9a Mon Sep 17 00:00:00 2001 From: Octavian Cinciu Date: Tue, 2 Aug 2016 16:29:46 +0300 Subject: [PATCH 2/2] PHPCS --- libraries/legacy/view/legacy.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/legacy/view/legacy.php b/libraries/legacy/view/legacy.php index f980956c85877..338e1448dd9f4 100644 --- a/libraries/legacy/view/legacy.php +++ b/libraries/legacy/view/legacy.php @@ -831,7 +831,7 @@ public function getForm() /** * Sets the document title according to Global Configuration options * - * @param string $title The page title + * @param string $title The page title * * @return void *