diff --git a/module/finc/src/finc/View/Helper/Root/Factory.php b/module/finc/src/finc/View/Helper/Root/Factory.php index b9f0bcca3d5acf8b1c4591c5d25be7ae903380f4..e4109ef4a2a8d6de1cde6956221ed5be15b0e8f9 100644 --- a/module/finc/src/finc/View/Helper/Root/Factory.php +++ b/module/finc/src/finc/View/Helper/Root/Factory.php @@ -208,4 +208,10 @@ class Factory empty($externalAccessLinks) ? [] : $externalAccessLinks ); } + + public static function getHeadTitle(ContainerInterface $container) + { + $config = $container->get('VuFind\Config')->get('config')->Site; + return new HeadTitle($config->title ?? ''); + } } diff --git a/module/finc/src/finc/View/Helper/Root/HeadTitle.php b/module/finc/src/finc/View/Helper/Root/HeadTitle.php new file mode 100644 index 0000000000000000000000000000000000000000..c4036a17429c5da292fb5e574bf9f40d53de3588 --- /dev/null +++ b/module/finc/src/finc/View/Helper/Root/HeadTitle.php @@ -0,0 +1,58 @@ +<?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); + } +} diff --git a/themes/finc/theme.config.php b/themes/finc/theme.config.php index d8ccfb67f974a065e14c9f4d74a4d34155223633..51037a227bb81a1179f169b376ce8b91026d8014 100644 --- a/themes/finc/theme.config.php +++ b/themes/finc/theme.config.php @@ -17,6 +17,7 @@ return [ 'recordLink' => 'finc\View\Helper\Root\RecordLink', 'record' => 'finc\View\Helper\Root\Record', 'flashmessages' => 'finc\View\Helper\Root\Flashmessages', + 'headTitle' => 'finc\View\Helper\Root\HeadTitle', ], 'factories' => [ 'finc\View\Helper\Root\BranchInfo' => @@ -41,6 +42,8 @@ return [ 'VuFind\View\Helper\Root\ResultFeedFactory', 'finc\View\Helper\Root\Flashmessages' => 'VuFind\View\Helper\Root\FlashmessagesFactory', + 'finc\View\Helper\Root\HeadTitle' => + 'finc\View\Helper\Root\Factory::getHeadTitle', ] ] ];