TYPO3 CMS  TYPO3_6-2
FormatsViewHelper.php
Go to the documentation of this file.
1 <?php
3 
23 
30  public function render(\TYPO3\CMS\Documentation\Domain\Model\DocumentTranslation $documentTranslation) {
31  $output = '';
32  foreach ($documentTranslation->getFormats() as $format) {
34  $output .= '<a ';
35 
36  $uri = '../' . $format->getPath();
37  $extension = substr($uri, strrpos($uri, '.') + 1);
38  if (strlen($extension) < 5) {
39  // This is direct link to a file
40  $output .= 'href="' . $uri . '"';
41  } else {
42  $extension = $format->getFormat();
43  if ($extension === 'json') {
44  $extension = 'js';
45  }
46  $output .= 'href="#" onclick="top.TYPO3.Backend.ContentContainer.setUrl(\'' . $uri . '\')"';
47  }
48 
49  $xliff = 'LLL:EXT:documentation/Resources/Private/Language/locallang.xlf';
50  $title = sprintf(
51  $GLOBALS['LANG']->sL($xliff . ':tx_documentation_domain_model_documentformat.format.title'),
52  $format->getFormat()
53  );
54  $output .= ' title="' . htmlspecialchars($title) . '">';
55  $spriteIconHtml = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForFile($extension);
56  $output .= $spriteIconHtml . '</a>' . LF;
57  }
58  return $output;
59  }
60 
61 }