2 namespace TYPO3\CMS\Documentation\ViewHelpers;
39 public function render(\TYPO3\CMS\Documentation\Domain\Model\DocumentTranslation $documentTranslation)
41 return static::renderStatic(
43 'documentTranslation' => $documentTranslation,
46 $this->renderingContext
62 $documentTranslation = $arguments[
'documentTranslation'];
66 $emptyIcon = $iconFactory->getIcon(
'empty-empty',
Icon::SIZE_SMALL)->render();
68 'html' =>
'<a class="btn btn-default disabled">' . $emptyIcon .
'</a>',
69 'pdf' =>
'<a class="btn btn-default disabled">' . $emptyIcon .
'</a>',
70 'sxw' =>
'<a class="btn btn-default disabled">' . $emptyIcon .
'</a>'
72 $formats = $documentTranslation->getFormats();
74 foreach ($formats as $format) {
79 $uri =
'../' . $format->getPath();
80 $documentFormat = $format->getFormat();
81 $extension = substr($uri, strrpos($uri,
'.') + 1);
82 if (strlen($extension) < 5) {
84 $output .=
'href="' . $uri .
'" class="btn btn-default"';
85 $iconHtml = static::getIconForFileExtension($extension, $iconFactory);
87 $output .=
'href="#" onclick="top.TYPO3.Backend.ContentContainer.setUrl(' .
GeneralUtility::quoteJSvalue($uri) .
')" class="btn btn-default"';
88 $iconHtml = static::getIconForFileExtension($documentFormat, $iconFactory);
91 $xliff =
'LLL:EXT:documentation/Resources/Private/Language/locallang.xlf';
93 $GLOBALS[
'LANG']->sL($xliff .
':tx_documentation_domain_model_documentformat.format.title'),
96 $output .=
' title="' . htmlspecialchars($title) .
'">';
97 $output .= $iconHtml .
'</a>' . LF;
98 if ($documentFormat ===
'json') {
100 $documentFormat =
'sxw';
102 $icons[$documentFormat] = $output;
104 return implode(
'', array_values($icons));
116 switch ($extension) {
119 $iconHtml = $iconFactory->getIcon(
'actions-file-' . $extension,
Icon::SIZE_SMALL)->render();
122 $iconHtml = $iconFactory->getIcon(
'actions-file-openoffice',
Icon::SIZE_SMALL)->render();
125 $iconHtml = $iconFactory->getIcon(
'actions-system-extension-documentation',
Icon::SIZE_SMALL)->render();