Skip to content
Snippets Groups Projects
Commit 6187e404 authored by Robert Lange's avatar Robert Lange
Browse files

Merge branch 'finc' into instance/fid

parents fef4c9e0 204902c6
Branches
Tags
No related merge requests found
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
*/ */
namespace finc\Controller\CustomTraits; namespace finc\Controller\CustomTraits;
use VuFind\Exception\Mail as MailException;
use finc\Mailer\Mailer as Mailer; use finc\Mailer\Mailer as Mailer;
use VuFind\Exception\Mail as MailException;
use Zend\Mail\Address as Address; use Zend\Mail\Address as Address;
/** /**
...@@ -161,10 +161,12 @@ trait EmailHoldTrait ...@@ -161,10 +161,12 @@ trait EmailHoldTrait
'Email/journalhold-plain.phtml', 'Email/journalhold-plain.phtml',
$details $details
); );
$subject = "Zeitschrift von " . $subject = sprintf(
$details['patron']['lastname'] . ", " . $emailProfile->subject,
$details['patron']['firstname'] . $details['patron']['lastname'],
" | Signatur: " . $details['callnumber']; $details['patron']['firstname'],
$details['callnumber']
);
$from = $reply = ( $from = $reply = (
isset($details['patron']['email']) isset($details['patron']['email'])
......
...@@ -221,4 +221,14 @@ class Factory ...@@ -221,4 +221,14 @@ class Factory
{ {
return new ExternalLink(); return new ExternalLink();
} }
/**
* Construct RenderArray
*
* @return RenderArray
*/
public static function getRenderArray()
{
return new RenderArray();
}
} }
<?php
/**
* View helper to render a portion of an array.
*
* PHP version 7
*
* Copyright (C) Leipzig University Library 2021.
*
* 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 Demian Katz <demian.katz@villanova.edu>
* @author Alexander Purr <purr@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;
/**
* View helper to render a portion of an array.
*
* @category VuFind
* @package View_Helpers
* @author Demian Katz <demian.katz@villanova.edu>
* @author Alexander Purr <purr@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 RenderArray extends \VuFind\View\Helper\Root\RenderArray
{
/**
* Render a portion of an array.
*
* @param string $tpl A template for displaying each row. This should
* include %%LABEL%% and %%VALUE%% placeholders
* @param array $arr An associative array of possible values to display
* @param array $rows A label => profile key associative array specifying
* which rows of $arr to display
* @param bool $hideEmpty enable hiding entry / row if value is empty
*
* @return string
*/
public function __invoke($tpl, $arr, $rows, $hideEmpty = false)
{
$html = '';
foreach ($rows as $label => $key) {
if (isset($arr[$key])) {
if (!($hideEmpty && empty($arr[$key]))) {
$html .= str_replace(
['%%LABEL%%', '%%VALUE%%'],
[$label, $this->view->escapeHtml($arr[$key])],
$tpl
);
}
}
}
return $html;
}
}
...@@ -18,6 +18,7 @@ return [ ...@@ -18,6 +18,7 @@ return [
'record' => 'finc\View\Helper\Root\Record', 'record' => 'finc\View\Helper\Root\Record',
'flashmessages' => 'finc\View\Helper\Root\Flashmessages', 'flashmessages' => 'finc\View\Helper\Root\Flashmessages',
'externalLink' => 'finc\View\Helper\Root\ExternalLink', 'externalLink' => 'finc\View\Helper\Root\ExternalLink',
'renderArray' => 'finc\View\Helper\Root\RenderArray',
], ],
'factories' => [ 'factories' => [
'finc\View\Helper\Root\BranchInfo' => 'finc\View\Helper\Root\BranchInfo' =>
...@@ -44,6 +45,8 @@ return [ ...@@ -44,6 +45,8 @@ return [
'VuFind\View\Helper\Root\FlashmessagesFactory', 'VuFind\View\Helper\Root\FlashmessagesFactory',
'finc\View\Helper\Root\ExternalLink' => 'finc\View\Helper\Root\ExternalLink' =>
'finc\View\Helper\Root\Factory::getExternalLink', 'finc\View\Helper\Root\Factory::getExternalLink',
'finc\View\Helper\Root\RenderArray' =>
'finc\View\Helper\Root\Factory::getRenderArray',
] ]
] ]
]; ];
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