Skip to content
Snippets Groups Projects
Commit f175bf58 authored by Dorian Merz's avatar Dorian Merz Committed by Robert Lange
Browse files

refs #17979 [finc] Add Library name suffix to HTML page header

* introduce finc HeadTitle ViewHelper
* use library name instead of empty title
parent e4cfb2a7
No related merge requests found
...@@ -208,4 +208,10 @@ class Factory ...@@ -208,4 +208,10 @@ class Factory
empty($externalAccessLinks) ? [] : $externalAccessLinks empty($externalAccessLinks) ? [] : $externalAccessLinks
); );
} }
public static function getHeadTitle(ContainerInterface $container)
{
$config = $container->get('VuFind\Config')->get('config')->Site;
return new HeadTitle($config->title ?? '');
}
} }
<?php
/**
* Head Title view helper
*
* PHP version 7
*
* Copyright (C) Leipzig University Library 2020.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category VuFind
* @package View_Helpers
* @author Dorian Merz <merz@ub.uni-leipzig.de>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development Wiki
*/
namespace finc\View\Helper\Root;
use Zend\View\Helper\HeadTitle as BaseHelper;
/**
* Head Title view helper
*
* @category VuFind
* @package View_Helpers
* @author Dorian Merz <merz@ub.uni-leipzig.de>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development Wiki
*/
class HeadTitle extends BaseHelper
{
protected $headerSuffix;
public function __construct($headerSuffix = '')
{
parent::__construct();
if (!empty($headerSuffix)) {
$this->headerSuffix = ' - '.$headerSuffix;
}
}
public function __invoke($title = null, $setType = null)
{
$title = $title ? : $this->headerSuffix;
return parent::__invoke($title, $setType);
}
}
...@@ -17,6 +17,7 @@ return [ ...@@ -17,6 +17,7 @@ return [
'recordLink' => 'finc\View\Helper\Root\RecordLink', 'recordLink' => 'finc\View\Helper\Root\RecordLink',
'record' => 'finc\View\Helper\Root\Record', 'record' => 'finc\View\Helper\Root\Record',
'flashmessages' => 'finc\View\Helper\Root\Flashmessages', 'flashmessages' => 'finc\View\Helper\Root\Flashmessages',
'headTitle' => 'finc\View\Helper\Root\HeadTitle',
], ],
'factories' => [ 'factories' => [
'finc\View\Helper\Root\BranchInfo' => 'finc\View\Helper\Root\BranchInfo' =>
...@@ -41,6 +42,8 @@ return [ ...@@ -41,6 +42,8 @@ return [
'VuFind\View\Helper\Root\ResultFeedFactory', 'VuFind\View\Helper\Root\ResultFeedFactory',
'finc\View\Helper\Root\Flashmessages' => 'finc\View\Helper\Root\Flashmessages' =>
'VuFind\View\Helper\Root\FlashmessagesFactory', 'VuFind\View\Helper\Root\FlashmessagesFactory',
'finc\View\Helper\Root\HeadTitle' =>
'finc\View\Helper\Root\Factory::getHeadTitle',
] ]
] ]
]; ];
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment