Passed
Pull Request — master (#70)
by Alexander
03:07
created

UserFunc::loadDocument()   A

Complexity

Conditions 5
Paths 5

Size

Total Lines 31
Code Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 21
c 2
b 0
f 0
dl 0
loc 31
rs 9.2728
cc 5
nc 5
nop 1
1
<?php
2
3
/**
4
 * (c) Kitodo. Key to digital objects e.V. <[email protected]>
5
 *
6
 * This file is part of the Kitodo and TYPO3 projects.
7
 *
8
 * @license GNU General Public License version 3 or later.
9
 * For the full copyright and license information, please read the
10
 * LICENSE.txt file that was distributed with this source code.
11
 */
12
13
namespace Kitodo\Dlf\Hooks;
14
15
use Kitodo\Dlf\Common\Document;
16
use Kitodo\Dlf\Common\Helper;
17
use Kitodo\Dlf\Common\IiifManifest;
18
use Psr\Log\LoggerAwareInterface;
19
use Psr\Log\LoggerAwareTrait;
20
use TYPO3\CMS\Core\Database\ConnectionPool;
21
use TYPO3\CMS\Core\Log\LogManager;
22
use TYPO3\CMS\Core\Utility\GeneralUtility;
23
24
/**
25
 * Helper for custom "userFunc"
26
 *
27
 * @author Alexander Bigga <[email protected]>
28
 * @author Sebastian Meyer <[email protected]>
29
 * @package TYPO3
30
 * @subpackage dlf
31
 * @access public
32
 */
33
class UserFunc implements LoggerAwareInterface
34
{
35
    use LoggerAwareTrait;
36
37
    /**
38
     * This holds the extension's parameter prefix
39
     * @see \Kitodo\Dlf\Common\AbstractPlugin
40
     *
41
     * @var string
42
     * @access protected
43
     */
44
    protected $prefixId = 'tx_dlf';
45
46
    /**
47
     * Helper to display document's thumbnail
48
     * @see dlf/Configuration/TCA/tx_dlf_documents.php
49
     *
50
     * @access public
51
     *
52
     * @param array &$params: An array with parameters
53
     *
54
     * @return string HTML <img> tag for thumbnail
55
     */
56
    public function displayThumbnail(&$params)
57
    {
58
        // Simulate TCA field type "passthrough".
59
        $output = '<input type="hidden" name="' . $params['itemFormElName'] . '" value="' . $params['itemFormElValue'] . '" />';
60
        if (!empty($params['itemFormElValue'])) {
61
            $output .= '<img alt="Thumbnail" title="' . $params['itemFormElValue'] . '" src="' . $params['itemFormElValue'] . '" />';
62
        }
63
        return $output;
64
    }
65
}
66