@@ -20,50 +20,50 @@ |
||
20 | 20 | */ |
21 | 21 | class StorageViewHelper extends AbstractViewHelper |
22 | 22 | { |
23 | - /** |
|
24 | - * @return void |
|
25 | - */ |
|
26 | - public function initializeArguments() |
|
27 | - { |
|
28 | - $this->registerArgument('objects', 'array', '', false, []); |
|
29 | - } |
|
23 | + /** |
|
24 | + * @return void |
|
25 | + */ |
|
26 | + public function initializeArguments() |
|
27 | + { |
|
28 | + $this->registerArgument('objects', 'array', '', false, []); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Render a file upload field |
|
33 | - * |
|
34 | - * @return string |
|
35 | - */ |
|
36 | - public function render() |
|
37 | - { |
|
38 | - $objects = $this->arguments['objects']; |
|
31 | + /** |
|
32 | + * Render a file upload field |
|
33 | + * |
|
34 | + * @return string |
|
35 | + */ |
|
36 | + public function render() |
|
37 | + { |
|
38 | + $objects = $this->arguments['objects']; |
|
39 | 39 | |
40 | - // Check if a storages is selected |
|
41 | - $currentStorage = $this->getMediaModule()->getCurrentStorage(); |
|
40 | + // Check if a storages is selected |
|
41 | + $currentStorage = $this->getMediaModule()->getCurrentStorage(); |
|
42 | 42 | |
43 | - $template = '<select name="%s[target]">%s</select>'; |
|
44 | - $options = []; |
|
45 | - foreach ($objects as $storage) { |
|
46 | - /** @var ResourceStorage $storage */ |
|
47 | - $options[] = sprintf( |
|
48 | - '<option value="%s" %s>%s %s</option>', |
|
49 | - $storage->getUid(), |
|
50 | - is_object($currentStorage) && $currentStorage->getUid() == $storage->getUid() ? 'selected="selected"' : '', |
|
51 | - $storage->getName(), |
|
52 | - !$storage->isOnline() ? '(offline)' : '' |
|
53 | - ); |
|
54 | - } |
|
55 | - return sprintf( |
|
56 | - $template, |
|
57 | - VidiModule::getParameterPrefix(), |
|
58 | - implode("\n", $options) |
|
59 | - ); |
|
60 | - } |
|
43 | + $template = '<select name="%s[target]">%s</select>'; |
|
44 | + $options = []; |
|
45 | + foreach ($objects as $storage) { |
|
46 | + /** @var ResourceStorage $storage */ |
|
47 | + $options[] = sprintf( |
|
48 | + '<option value="%s" %s>%s %s</option>', |
|
49 | + $storage->getUid(), |
|
50 | + is_object($currentStorage) && $currentStorage->getUid() == $storage->getUid() ? 'selected="selected"' : '', |
|
51 | + $storage->getName(), |
|
52 | + !$storage->isOnline() ? '(offline)' : '' |
|
53 | + ); |
|
54 | + } |
|
55 | + return sprintf( |
|
56 | + $template, |
|
57 | + VidiModule::getParameterPrefix(), |
|
58 | + implode("\n", $options) |
|
59 | + ); |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * @return MediaModule|object |
|
64 | - */ |
|
65 | - protected function getMediaModule() |
|
66 | - { |
|
67 | - return GeneralUtility::makeInstance(MediaModule::class); |
|
68 | - } |
|
62 | + /** |
|
63 | + * @return MediaModule|object |
|
64 | + */ |
|
65 | + protected function getMediaModule() |
|
66 | + { |
|
67 | + return GeneralUtility::makeInstance(MediaModule::class); |
|
68 | + } |
|
69 | 69 | } |
@@ -21,122 +21,122 @@ |
||
21 | 21 | */ |
22 | 22 | class FooterViewHelper extends AbstractViewHelper |
23 | 23 | { |
24 | - /** |
|
25 | - * Render a form footer. |
|
26 | - * Example: |
|
27 | - * Created on 30-12-12 by John Updated on 22-05-12 by Jane |
|
28 | - * |
|
29 | - * @return string |
|
30 | - */ |
|
31 | - public function render() |
|
32 | - { |
|
33 | - /** @var File $file */ |
|
34 | - $file = $this->templateVariableContainer->get('file'); |
|
35 | - $template = '<span>%s %s %s</span> <span style="padding-left: 50px">%s %s %s</span>'; |
|
36 | - |
|
37 | - $format = sprintf( |
|
38 | - '%s @ %s', |
|
39 | - $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], |
|
40 | - $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'] |
|
41 | - ); |
|
42 | - |
|
43 | - $arguments = array( |
|
44 | - 'date' => null, |
|
45 | - 'format' => $format, |
|
46 | - 'base' => null |
|
47 | - ); |
|
48 | - |
|
49 | - $result = sprintf( |
|
50 | - $template, |
|
51 | - LocalizationUtility::translate('created_on', 'media'), |
|
52 | - $file->getProperty('crdate') ? $this->formatDate($arguments, $file->getProperty('crdate')) : '', |
|
53 | - $this->getUserName($file->getProperty('cruser_id')), |
|
54 | - LocalizationUtility::translate('updated_on', 'media'), |
|
55 | - $file->getProperty('tstamp') ? $this->formatDate($arguments, '@' . $file->getProperty('tstamp')) : '', |
|
56 | - $this->getUserName($file->getProperty('upuser_id')) |
|
57 | - ); |
|
58 | - |
|
59 | - return $result; |
|
60 | - } |
|
61 | - |
|
62 | - |
|
63 | - /** |
|
64 | - * Get the User name to be displayed |
|
65 | - * |
|
66 | - * @param int $userIdentifier |
|
67 | - * @return string |
|
68 | - */ |
|
69 | - public function getUserName($userIdentifier) |
|
70 | - { |
|
71 | - $username = ''; |
|
72 | - |
|
73 | - if ($userIdentifier > 0) { |
|
74 | - $record = $this->getDataService() |
|
75 | - ->getRecord( |
|
76 | - 'be_users', |
|
77 | - [ |
|
78 | - 'uid' => $userIdentifier |
|
79 | - ] |
|
80 | - ); |
|
81 | - $username = sprintf( |
|
82 | - '%s %s', |
|
83 | - LocalizationUtility::translate('by', 'media'), |
|
84 | - empty($record['realName']) ? $record['username'] : $record['realName'] |
|
85 | - ); |
|
86 | - } |
|
87 | - |
|
88 | - return $username; |
|
89 | - } |
|
90 | - |
|
91 | - /** |
|
92 | - * @return object|DataService |
|
93 | - */ |
|
94 | - protected function getDataService(): DataService |
|
95 | - { |
|
96 | - return GeneralUtility::makeInstance(DataService::class); |
|
97 | - } |
|
98 | - |
|
99 | - /** |
|
100 | - * @param array $arguments |
|
101 | - * @param int|string $date |
|
102 | - * @return string |
|
103 | - * @throws \TYPO3Fluid\Fluid\Core\ViewHelper\Exception |
|
104 | - */ |
|
105 | - public function formatDate(array $arguments, $date) |
|
106 | - { |
|
107 | - $format = $arguments['format']; |
|
108 | - $base = $date; |
|
109 | - if (is_string($base)) { |
|
110 | - $base = trim($base); |
|
111 | - } |
|
112 | - |
|
113 | - if ($format === '') { |
|
114 | - $format = $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] ?: 'Y-m-d'; |
|
115 | - } |
|
116 | - |
|
117 | - if (is_string($date)) { |
|
118 | - $date = trim($date); |
|
119 | - } |
|
120 | - |
|
121 | - if ($date === '') { |
|
122 | - $date = 'now'; |
|
123 | - } |
|
124 | - |
|
125 | - if (!$date instanceof \DateTimeInterface) { |
|
126 | - try { |
|
127 | - $base = $base instanceof \DateTimeInterface ? $base->format('U') : strtotime((MathUtility::canBeInterpretedAsInteger($base) ? '@' : '') . $base); |
|
128 | - $dateTimestamp = strtotime((MathUtility::canBeInterpretedAsInteger($date) ? '@' : '') . $date, $base); |
|
129 | - $date = new \DateTime('@' . $dateTimestamp); |
|
130 | - $date->setTimezone(new \DateTimeZone(date_default_timezone_get())); |
|
131 | - } catch (\Exception $exception) { |
|
132 | - throw new \TYPO3Fluid\Fluid\Core\ViewHelper\Exception('"' . $date . '" could not be parsed by \DateTime constructor: ' . $exception->getMessage(), 1241722579); |
|
133 | - } |
|
134 | - } |
|
135 | - |
|
136 | - if (strpos($format, '%') !== false) { |
|
137 | - return strftime($format, $date->format('U')); |
|
138 | - } else { |
|
139 | - return $date->format($format); |
|
140 | - } |
|
141 | - } |
|
24 | + /** |
|
25 | + * Render a form footer. |
|
26 | + * Example: |
|
27 | + * Created on 30-12-12 by John Updated on 22-05-12 by Jane |
|
28 | + * |
|
29 | + * @return string |
|
30 | + */ |
|
31 | + public function render() |
|
32 | + { |
|
33 | + /** @var File $file */ |
|
34 | + $file = $this->templateVariableContainer->get('file'); |
|
35 | + $template = '<span>%s %s %s</span> <span style="padding-left: 50px">%s %s %s</span>'; |
|
36 | + |
|
37 | + $format = sprintf( |
|
38 | + '%s @ %s', |
|
39 | + $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], |
|
40 | + $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'] |
|
41 | + ); |
|
42 | + |
|
43 | + $arguments = array( |
|
44 | + 'date' => null, |
|
45 | + 'format' => $format, |
|
46 | + 'base' => null |
|
47 | + ); |
|
48 | + |
|
49 | + $result = sprintf( |
|
50 | + $template, |
|
51 | + LocalizationUtility::translate('created_on', 'media'), |
|
52 | + $file->getProperty('crdate') ? $this->formatDate($arguments, $file->getProperty('crdate')) : '', |
|
53 | + $this->getUserName($file->getProperty('cruser_id')), |
|
54 | + LocalizationUtility::translate('updated_on', 'media'), |
|
55 | + $file->getProperty('tstamp') ? $this->formatDate($arguments, '@' . $file->getProperty('tstamp')) : '', |
|
56 | + $this->getUserName($file->getProperty('upuser_id')) |
|
57 | + ); |
|
58 | + |
|
59 | + return $result; |
|
60 | + } |
|
61 | + |
|
62 | + |
|
63 | + /** |
|
64 | + * Get the User name to be displayed |
|
65 | + * |
|
66 | + * @param int $userIdentifier |
|
67 | + * @return string |
|
68 | + */ |
|
69 | + public function getUserName($userIdentifier) |
|
70 | + { |
|
71 | + $username = ''; |
|
72 | + |
|
73 | + if ($userIdentifier > 0) { |
|
74 | + $record = $this->getDataService() |
|
75 | + ->getRecord( |
|
76 | + 'be_users', |
|
77 | + [ |
|
78 | + 'uid' => $userIdentifier |
|
79 | + ] |
|
80 | + ); |
|
81 | + $username = sprintf( |
|
82 | + '%s %s', |
|
83 | + LocalizationUtility::translate('by', 'media'), |
|
84 | + empty($record['realName']) ? $record['username'] : $record['realName'] |
|
85 | + ); |
|
86 | + } |
|
87 | + |
|
88 | + return $username; |
|
89 | + } |
|
90 | + |
|
91 | + /** |
|
92 | + * @return object|DataService |
|
93 | + */ |
|
94 | + protected function getDataService(): DataService |
|
95 | + { |
|
96 | + return GeneralUtility::makeInstance(DataService::class); |
|
97 | + } |
|
98 | + |
|
99 | + /** |
|
100 | + * @param array $arguments |
|
101 | + * @param int|string $date |
|
102 | + * @return string |
|
103 | + * @throws \TYPO3Fluid\Fluid\Core\ViewHelper\Exception |
|
104 | + */ |
|
105 | + public function formatDate(array $arguments, $date) |
|
106 | + { |
|
107 | + $format = $arguments['format']; |
|
108 | + $base = $date; |
|
109 | + if (is_string($base)) { |
|
110 | + $base = trim($base); |
|
111 | + } |
|
112 | + |
|
113 | + if ($format === '') { |
|
114 | + $format = $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] ?: 'Y-m-d'; |
|
115 | + } |
|
116 | + |
|
117 | + if (is_string($date)) { |
|
118 | + $date = trim($date); |
|
119 | + } |
|
120 | + |
|
121 | + if ($date === '') { |
|
122 | + $date = 'now'; |
|
123 | + } |
|
124 | + |
|
125 | + if (!$date instanceof \DateTimeInterface) { |
|
126 | + try { |
|
127 | + $base = $base instanceof \DateTimeInterface ? $base->format('U') : strtotime((MathUtility::canBeInterpretedAsInteger($base) ? '@' : '') . $base); |
|
128 | + $dateTimestamp = strtotime((MathUtility::canBeInterpretedAsInteger($date) ? '@' : '') . $date, $base); |
|
129 | + $date = new \DateTime('@' . $dateTimestamp); |
|
130 | + $date->setTimezone(new \DateTimeZone(date_default_timezone_get())); |
|
131 | + } catch (\Exception $exception) { |
|
132 | + throw new \TYPO3Fluid\Fluid\Core\ViewHelper\Exception('"' . $date . '" could not be parsed by \DateTime constructor: ' . $exception->getMessage(), 1241722579); |
|
133 | + } |
|
134 | + } |
|
135 | + |
|
136 | + if (strpos($format, '%') !== false) { |
|
137 | + return strftime($format, $date->format('U')); |
|
138 | + } else { |
|
139 | + return $date->format($format); |
|
140 | + } |
|
141 | + } |
|
142 | 142 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $file->getProperty('crdate') ? $this->formatDate($arguments, $file->getProperty('crdate')) : '', |
53 | 53 | $this->getUserName($file->getProperty('cruser_id')), |
54 | 54 | LocalizationUtility::translate('updated_on', 'media'), |
55 | - $file->getProperty('tstamp') ? $this->formatDate($arguments, '@' . $file->getProperty('tstamp')) : '', |
|
55 | + $file->getProperty('tstamp') ? $this->formatDate($arguments, '@'.$file->getProperty('tstamp')) : '', |
|
56 | 56 | $this->getUserName($file->getProperty('upuser_id')) |
57 | 57 | ); |
58 | 58 | |
@@ -124,12 +124,12 @@ discard block |
||
124 | 124 | |
125 | 125 | if (!$date instanceof \DateTimeInterface) { |
126 | 126 | try { |
127 | - $base = $base instanceof \DateTimeInterface ? $base->format('U') : strtotime((MathUtility::canBeInterpretedAsInteger($base) ? '@' : '') . $base); |
|
128 | - $dateTimestamp = strtotime((MathUtility::canBeInterpretedAsInteger($date) ? '@' : '') . $date, $base); |
|
129 | - $date = new \DateTime('@' . $dateTimestamp); |
|
127 | + $base = $base instanceof \DateTimeInterface ? $base->format('U') : strtotime((MathUtility::canBeInterpretedAsInteger($base) ? '@' : '').$base); |
|
128 | + $dateTimestamp = strtotime((MathUtility::canBeInterpretedAsInteger($date) ? '@' : '').$date, $base); |
|
129 | + $date = new \DateTime('@'.$dateTimestamp); |
|
130 | 130 | $date->setTimezone(new \DateTimeZone(date_default_timezone_get())); |
131 | 131 | } catch (\Exception $exception) { |
132 | - throw new \TYPO3Fluid\Fluid\Core\ViewHelper\Exception('"' . $date . '" could not be parsed by \DateTime constructor: ' . $exception->getMessage(), 1241722579); |
|
132 | + throw new \TYPO3Fluid\Fluid\Core\ViewHelper\Exception('"'.$date.'" could not be parsed by \DateTime constructor: '.$exception->getMessage(), 1241722579); |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 |
@@ -17,31 +17,31 @@ |
||
17 | 17 | */ |
18 | 18 | class ImageDimensionViewHelper extends AbstractViewHelper |
19 | 19 | { |
20 | - /** |
|
21 | - * @return void |
|
22 | - */ |
|
23 | - public function initializeArguments() |
|
24 | - { |
|
25 | - $this->registerArgument('preset', 'string', '', true); |
|
26 | - $this->registerArgument('dimension', 'string', '', false, 'width'); |
|
27 | - } |
|
20 | + /** |
|
21 | + * @return void |
|
22 | + */ |
|
23 | + public function initializeArguments() |
|
24 | + { |
|
25 | + $this->registerArgument('preset', 'string', '', true); |
|
26 | + $this->registerArgument('dimension', 'string', '', false, 'width'); |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * Returns preset values related to an image dimension |
|
31 | - * |
|
32 | - * @return int |
|
33 | - */ |
|
34 | - public function render() |
|
35 | - { |
|
36 | - $preset = $this->arguments['preset']; |
|
37 | - $dimension = $this->arguments['dimension']; |
|
29 | + /** |
|
30 | + * Returns preset values related to an image dimension |
|
31 | + * |
|
32 | + * @return int |
|
33 | + */ |
|
34 | + public function render() |
|
35 | + { |
|
36 | + $preset = $this->arguments['preset']; |
|
37 | + $dimension = $this->arguments['dimension']; |
|
38 | 38 | |
39 | - $imageDimension = ImagePresetUtility::getInstance()->preset($preset); |
|
40 | - if ($dimension === 'width') { |
|
41 | - $result = $imageDimension->getWidth(); |
|
42 | - } else { |
|
43 | - $result = $imageDimension->getHeight(); |
|
44 | - } |
|
45 | - return $result; |
|
46 | - } |
|
39 | + $imageDimension = ImagePresetUtility::getInstance()->preset($preset); |
|
40 | + if ($dimension === 'width') { |
|
41 | + $result = $imageDimension->getWidth(); |
|
42 | + } else { |
|
43 | + $result = $imageDimension->getHeight(); |
|
44 | + } |
|
45 | + return $result; |
|
46 | + } |
|
47 | 47 | } |
@@ -17,13 +17,13 @@ |
||
17 | 17 | */ |
18 | 18 | class ModuleSignatureViewHelper extends AbstractViewHelper |
19 | 19 | { |
20 | - /** |
|
21 | - * Returns the BE module signature. |
|
22 | - * |
|
23 | - * @return string |
|
24 | - */ |
|
25 | - public function render() |
|
26 | - { |
|
27 | - return VidiModule::getSignature(); |
|
28 | - } |
|
20 | + /** |
|
21 | + * Returns the BE module signature. |
|
22 | + * |
|
23 | + * @return string |
|
24 | + */ |
|
25 | + public function render() |
|
26 | + { |
|
27 | + return VidiModule::getSignature(); |
|
28 | + } |
|
29 | 29 | } |
@@ -19,36 +19,36 @@ |
||
19 | 19 | */ |
20 | 20 | class ExistsViewHelper extends AbstractViewHelper |
21 | 21 | { |
22 | - /** |
|
23 | - * @return void |
|
24 | - */ |
|
25 | - public function initializeArguments() |
|
26 | - { |
|
27 | - $this->registerArgument('file', 'mixed', '', true); |
|
28 | - } |
|
22 | + /** |
|
23 | + * @return void |
|
24 | + */ |
|
25 | + public function initializeArguments() |
|
26 | + { |
|
27 | + $this->registerArgument('file', 'mixed', '', true); |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
31 | - * Returns a property value of a file given by the context. |
|
32 | - * |
|
33 | - * @return bool |
|
34 | - */ |
|
35 | - public function render() |
|
36 | - { |
|
37 | - /** @var File|Content|int $file $file */ |
|
38 | - $file = $this->arguments['file']; |
|
30 | + /** |
|
31 | + * Returns a property value of a file given by the context. |
|
32 | + * |
|
33 | + * @return bool |
|
34 | + */ |
|
35 | + public function render() |
|
36 | + { |
|
37 | + /** @var File|Content|int $file $file */ |
|
38 | + $file = $this->arguments['file']; |
|
39 | 39 | |
40 | - if (!$file instanceof File) { |
|
41 | - $file = $this->getFileConverter()->convert($file); |
|
42 | - } |
|
40 | + if (!$file instanceof File) { |
|
41 | + $file = $this->getFileConverter()->convert($file); |
|
42 | + } |
|
43 | 43 | |
44 | - return $file->exists(); |
|
45 | - } |
|
44 | + return $file->exists(); |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * @return ContentToFileConverter|object |
|
49 | - */ |
|
50 | - protected function getFileConverter() |
|
51 | - { |
|
52 | - return GeneralUtility::makeInstance(ContentToFileConverter::class); |
|
53 | - } |
|
47 | + /** |
|
48 | + * @return ContentToFileConverter|object |
|
49 | + */ |
|
50 | + protected function getFileConverter() |
|
51 | + { |
|
52 | + return GeneralUtility::makeInstance(ContentToFileConverter::class); |
|
53 | + } |
|
54 | 54 | } |
@@ -19,37 +19,37 @@ |
||
19 | 19 | */ |
20 | 20 | class UriViewHelper extends AbstractViewHelper |
21 | 21 | { |
22 | - /** |
|
23 | - * @return void |
|
24 | - */ |
|
25 | - public function initializeArguments() |
|
26 | - { |
|
27 | - $this->registerArgument('file', 'mixed', '', true); |
|
28 | - $this->registerArgument('relative', 'bool', '', false, false); |
|
29 | - } |
|
22 | + /** |
|
23 | + * @return void |
|
24 | + */ |
|
25 | + public function initializeArguments() |
|
26 | + { |
|
27 | + $this->registerArgument('file', 'mixed', '', true); |
|
28 | + $this->registerArgument('relative', 'bool', '', false, false); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Returns a property value of a file given by the context. |
|
33 | - * |
|
34 | - * @return string |
|
35 | - */ |
|
36 | - public function render() |
|
37 | - { |
|
38 | - /** @var File|Content|int $file $file */ |
|
39 | - $file = $this->arguments['file']; |
|
40 | - $relative = $this->arguments['relative']; |
|
31 | + /** |
|
32 | + * Returns a property value of a file given by the context. |
|
33 | + * |
|
34 | + * @return string |
|
35 | + */ |
|
36 | + public function render() |
|
37 | + { |
|
38 | + /** @var File|Content|int $file $file */ |
|
39 | + $file = $this->arguments['file']; |
|
40 | + $relative = $this->arguments['relative']; |
|
41 | 41 | |
42 | - if (!$file instanceof File) { |
|
43 | - $file = $this->getFileConverter()->convert($file); |
|
44 | - } |
|
45 | - return $file->getPublicUrl($relative); |
|
46 | - } |
|
42 | + if (!$file instanceof File) { |
|
43 | + $file = $this->getFileConverter()->convert($file); |
|
44 | + } |
|
45 | + return $file->getPublicUrl($relative); |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * @return ContentToFileConverter|object |
|
50 | - */ |
|
51 | - protected function getFileConverter() |
|
52 | - { |
|
53 | - return GeneralUtility::makeInstance(ContentToFileConverter::class); |
|
54 | - } |
|
48 | + /** |
|
49 | + * @return ContentToFileConverter|object |
|
50 | + */ |
|
51 | + protected function getFileConverter() |
|
52 | + { |
|
53 | + return GeneralUtility::makeInstance(ContentToFileConverter::class); |
|
54 | + } |
|
55 | 55 | } |
@@ -17,25 +17,25 @@ |
||
17 | 17 | */ |
18 | 18 | class PropertyViewHelper extends AbstractViewHelper |
19 | 19 | { |
20 | - /** |
|
21 | - * @return void |
|
22 | - */ |
|
23 | - public function initializeArguments() |
|
24 | - { |
|
25 | - $this->registerArgument('name', 'string', '', true); |
|
26 | - } |
|
20 | + /** |
|
21 | + * @return void |
|
22 | + */ |
|
23 | + public function initializeArguments() |
|
24 | + { |
|
25 | + $this->registerArgument('name', 'string', '', true); |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
29 | - * Returns a property value of a file given by the context. |
|
30 | - * |
|
31 | - * @return string |
|
32 | - */ |
|
33 | - public function render() |
|
34 | - { |
|
35 | - $name = $this->arguments['name']; |
|
28 | + /** |
|
29 | + * Returns a property value of a file given by the context. |
|
30 | + * |
|
31 | + * @return string |
|
32 | + */ |
|
33 | + public function render() |
|
34 | + { |
|
35 | + $name = $this->arguments['name']; |
|
36 | 36 | |
37 | - /** @var File $file */ |
|
38 | - $file = $this->templateVariableContainer->get('file'); |
|
39 | - return $file->getProperty($name); |
|
40 | - } |
|
37 | + /** @var File $file */ |
|
38 | + $file = $this->templateVariableContainer->get('file'); |
|
39 | + return $file->getProperty($name); |
|
40 | + } |
|
41 | 41 | } |
@@ -22,68 +22,68 @@ |
||
22 | 22 | */ |
23 | 23 | class ThumbnailViewHelper extends AbstractViewHelper |
24 | 24 | { |
25 | - /** |
|
26 | - * @return void |
|
27 | - */ |
|
28 | - public function initializeArguments() |
|
29 | - { |
|
30 | - $this->registerArgument('file', 'mixed', 'The source file', false, null); |
|
31 | - $this->registerArgument('configuration', 'array', 'Configuration to be given for the thumbnail processing.', false, []); |
|
32 | - $this->registerArgument('attributes', 'array', 'DOM attributes to add to the thumbnail image', false, ''); |
|
33 | - $this->registerArgument('preset', 'string', 'Image dimension preset', false, ''); |
|
34 | - $this->registerArgument('output', 'string', 'Can be: uri, image, imageWrapped', false, 'image'); |
|
35 | - $this->registerArgument('configurationWrap', 'array', 'The configuration given to the wrap.', false, ''); |
|
36 | - } |
|
25 | + /** |
|
26 | + * @return void |
|
27 | + */ |
|
28 | + public function initializeArguments() |
|
29 | + { |
|
30 | + $this->registerArgument('file', 'mixed', 'The source file', false, null); |
|
31 | + $this->registerArgument('configuration', 'array', 'Configuration to be given for the thumbnail processing.', false, []); |
|
32 | + $this->registerArgument('attributes', 'array', 'DOM attributes to add to the thumbnail image', false, ''); |
|
33 | + $this->registerArgument('preset', 'string', 'Image dimension preset', false, ''); |
|
34 | + $this->registerArgument('output', 'string', 'Can be: uri, image, imageWrapped', false, 'image'); |
|
35 | + $this->registerArgument('configurationWrap', 'array', 'The configuration given to the wrap.', false, ''); |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * Returns a configurable thumbnail of an asset |
|
40 | - * |
|
41 | - * @throws \Exception |
|
42 | - * @return string |
|
43 | - */ |
|
44 | - public function render() |
|
45 | - { |
|
46 | - $file = $this->arguments['file']; |
|
47 | - $preset = $this->arguments['preset']; |
|
48 | - $configuration = $this->arguments['configuration']; |
|
49 | - if (!is_array($configuration)) { |
|
50 | - $configuration = array(); |
|
51 | - } |
|
52 | - $configurationWrap = $this->arguments['configurationWrap']; |
|
53 | - $attributes = $this->arguments['attributes']; |
|
54 | - $output = $this->arguments['output']; |
|
38 | + /** |
|
39 | + * Returns a configurable thumbnail of an asset |
|
40 | + * |
|
41 | + * @throws \Exception |
|
42 | + * @return string |
|
43 | + */ |
|
44 | + public function render() |
|
45 | + { |
|
46 | + $file = $this->arguments['file']; |
|
47 | + $preset = $this->arguments['preset']; |
|
48 | + $configuration = $this->arguments['configuration']; |
|
49 | + if (!is_array($configuration)) { |
|
50 | + $configuration = array(); |
|
51 | + } |
|
52 | + $configurationWrap = $this->arguments['configurationWrap']; |
|
53 | + $attributes = $this->arguments['attributes']; |
|
54 | + $output = $this->arguments['output']; |
|
55 | 55 | |
56 | - if ($file instanceof Content) { |
|
57 | - $file = $this->getFileConverter()->convert($file); |
|
58 | - } elseif (!($file instanceof File)) { |
|
59 | - $file = $this->getResourceFactory()->getFileObject((int)$file); |
|
60 | - } |
|
61 | - if ($preset) { |
|
62 | - $imageDimension = ImagePresetUtility::getInstance()->preset($preset); |
|
63 | - $configuration['width'] = $imageDimension->getWidth(); |
|
64 | - $configuration['height'] = $imageDimension->getHeight(); |
|
65 | - } |
|
66 | - /** @var $thumbnailService \Fab\Media\Thumbnail\ThumbnailService */ |
|
67 | - $thumbnailService = GeneralUtility::makeInstance(ThumbnailService::class, $file); |
|
68 | - $thumbnail = $thumbnailService->setConfiguration($configuration) |
|
69 | - ->setConfigurationWrap($configurationWrap) |
|
70 | - ->setAttributes($attributes) |
|
71 | - ->setOutputType($output) |
|
72 | - ->create(); |
|
56 | + if ($file instanceof Content) { |
|
57 | + $file = $this->getFileConverter()->convert($file); |
|
58 | + } elseif (!($file instanceof File)) { |
|
59 | + $file = $this->getResourceFactory()->getFileObject((int)$file); |
|
60 | + } |
|
61 | + if ($preset) { |
|
62 | + $imageDimension = ImagePresetUtility::getInstance()->preset($preset); |
|
63 | + $configuration['width'] = $imageDimension->getWidth(); |
|
64 | + $configuration['height'] = $imageDimension->getHeight(); |
|
65 | + } |
|
66 | + /** @var $thumbnailService \Fab\Media\Thumbnail\ThumbnailService */ |
|
67 | + $thumbnailService = GeneralUtility::makeInstance(ThumbnailService::class, $file); |
|
68 | + $thumbnail = $thumbnailService->setConfiguration($configuration) |
|
69 | + ->setConfigurationWrap($configurationWrap) |
|
70 | + ->setAttributes($attributes) |
|
71 | + ->setOutputType($output) |
|
72 | + ->create(); |
|
73 | 73 | |
74 | - return $thumbnail; |
|
75 | - } |
|
74 | + return $thumbnail; |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * @return ContentToFileConverter|object |
|
79 | - */ |
|
80 | - protected function getFileConverter() |
|
81 | - { |
|
82 | - return GeneralUtility::makeInstance(ContentToFileConverter::class); |
|
83 | - } |
|
77 | + /** |
|
78 | + * @return ContentToFileConverter|object |
|
79 | + */ |
|
80 | + protected function getFileConverter() |
|
81 | + { |
|
82 | + return GeneralUtility::makeInstance(ContentToFileConverter::class); |
|
83 | + } |
|
84 | 84 | |
85 | - protected function getResourceFactory(): ResourceFactory |
|
86 | - { |
|
87 | - return GeneralUtility::makeInstance(ResourceFactory::class); |
|
88 | - } |
|
85 | + protected function getResourceFactory(): ResourceFactory |
|
86 | + { |
|
87 | + return GeneralUtility::makeInstance(ResourceFactory::class); |
|
88 | + } |
|
89 | 89 | } |
@@ -18,37 +18,37 @@ |
||
18 | 18 | */ |
19 | 19 | class FormResultCompiler extends \TYPO3\CMS\Backend\Form\FormResultCompiler |
20 | 20 | { |
21 | - /** |
|
22 | - * JavaScript bottom code |
|
23 | - * |
|
24 | - * @param string $formname The identification of the form on the page. |
|
25 | - * @return string A section with JavaScript - if $update is false, embedded in <script></script> |
|
26 | - */ |
|
27 | - protected function JSbottom() |
|
28 | - { |
|
29 | - $out = parent::JSbottom(); |
|
21 | + /** |
|
22 | + * JavaScript bottom code |
|
23 | + * |
|
24 | + * @param string $formname The identification of the form on the page. |
|
25 | + * @return string A section with JavaScript - if $update is false, embedded in <script></script> |
|
26 | + */ |
|
27 | + protected function JSbottom() |
|
28 | + { |
|
29 | + $out = parent::JSbottom(); |
|
30 | 30 | |
31 | - $tsConfig = $this->getBackendUser()->getTSConfig(); |
|
32 | - $enableMediaFilePicker = (bool)$tsConfig['options.vidi.enableMediaFilePicker']; |
|
33 | - if ($enableMediaFilePicker) { |
|
34 | - $pageRenderer = $this->getPageRenderer(); |
|
35 | - $pageRenderer->loadRequireJsModule('TYPO3/CMS/Media/MediaFormEngine', 'function(MediaFormEngine) { |
|
31 | + $tsConfig = $this->getBackendUser()->getTSConfig(); |
|
32 | + $enableMediaFilePicker = (bool)$tsConfig['options.vidi.enableMediaFilePicker']; |
|
33 | + if ($enableMediaFilePicker) { |
|
34 | + $pageRenderer = $this->getPageRenderer(); |
|
35 | + $pageRenderer->loadRequireJsModule('TYPO3/CMS/Media/MediaFormEngine', 'function(MediaFormEngine) { |
|
36 | 36 | MediaFormEngine.vidiModuleUrl = \'' . BackendUtility::getModuleUrl(VidiModule::getSignature()) . '\'; |
37 | 37 | MediaFormEngine.vidiModulePrefix = \'' . VidiModule::getParameterPrefix() . '\'; |
38 | 38 | MediaFormEngine.browserUrl = ' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('wizard_element_browser')) . '; |
39 | 39 | }'); |
40 | - } |
|
40 | + } |
|
41 | 41 | |
42 | - return $out; |
|
43 | - } |
|
42 | + return $out; |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * Returns an instance of the current Backend User. |
|
47 | - * |
|
48 | - * @return BackendUserAuthentication |
|
49 | - */ |
|
50 | - protected function getBackendUser() |
|
51 | - { |
|
52 | - return $GLOBALS['BE_USER']; |
|
53 | - } |
|
45 | + /** |
|
46 | + * Returns an instance of the current Backend User. |
|
47 | + * |
|
48 | + * @return BackendUserAuthentication |
|
49 | + */ |
|
50 | + protected function getBackendUser() |
|
51 | + { |
|
52 | + return $GLOBALS['BE_USER']; |
|
53 | + } |
|
54 | 54 | } |
@@ -33,9 +33,9 @@ |
||
33 | 33 | if ($enableMediaFilePicker) { |
34 | 34 | $pageRenderer = $this->getPageRenderer(); |
35 | 35 | $pageRenderer->loadRequireJsModule('TYPO3/CMS/Media/MediaFormEngine', 'function(MediaFormEngine) { |
36 | - MediaFormEngine.vidiModuleUrl = \'' . BackendUtility::getModuleUrl(VidiModule::getSignature()) . '\'; |
|
37 | - MediaFormEngine.vidiModulePrefix = \'' . VidiModule::getParameterPrefix() . '\'; |
|
38 | - MediaFormEngine.browserUrl = ' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('wizard_element_browser')) . '; |
|
36 | + MediaFormEngine.vidiModuleUrl = \'' . BackendUtility::getModuleUrl(VidiModule::getSignature()).'\'; |
|
37 | + MediaFormEngine.vidiModulePrefix = \'' . VidiModule::getParameterPrefix().'\'; |
|
38 | + MediaFormEngine.browserUrl = ' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('wizard_element_browser')).'; |
|
39 | 39 | }'); |
40 | 40 | } |
41 | 41 |