TYPO3 CMS  TYPO3_6-2
DownloadExtensionViewHelper.php
Go to the documentation of this file.
1 <?php
3 
22 
26  protected $tagName = 'form';
27 
34  public function render(\TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension) {
36  if (empty($installPaths)) {
37  return '';
38  }
39  $pathSelector = '<ul class="is-hidden">';
40  foreach ($installPaths as $installPathType => $installPath) {
41  $pathSelector .= '<li>
42  <input type="radio" id="' . htmlspecialchars($extension->getExtensionKey()) . '-downloadPath-' . htmlspecialchars($installPathType) . '" name="' . htmlspecialchars($this->getFieldNamePrefix('downloadPath')) . '[downloadPath]" class="downloadPath" value="' . htmlspecialchars($installPathType) . '"' . ($installPathType == 'Local' ? ' checked="checked"' : '') . '/>
43  <label for="' . htmlspecialchars($extension->getExtensionKey()) . '-downloadPath-' . htmlspecialchars($installPathType) . '">' . htmlspecialchars($installPathType) . '</label>
44  </li>';
45  }
46  $pathSelector .= '</ul>';
47  $uriBuilder = $this->controllerContext->getUriBuilder();
48  $action = 'checkDependencies';
49  $uriBuilder->reset();
50  $uriBuilder->setFormat('json');
51  $uri = $uriBuilder->uriFor($action, array(
52  'extension' => (int)$extension->getUid()
53  ), 'Download');
54  $this->tag->addAttribute('data-href', $uri);
55 
56  // @TODO Clean-up
57  $iconClasses = "t3-icon t3-icon-actions t3-icon-system-extension-import";
58  $label = '<input title="' . \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('extensionList.downloadViewHelper.submit', 'extensionmanager') . '" type="submit" class="' . $iconClasses . '" value="' . \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('extensionList.downloadViewHelper.submit', 'extensionmanager') . '">';
59 
60  $this->tag->setContent($label . $pathSelector);
61  $this->tag->addAttribute('class', 'download');
62  return '<div id="' . htmlspecialchars($extension->getExtensionKey()) . '-downloadFromTer" class="downloadFromTer">' . $this->tag->render() . '</div>';
63  }
64 
65 }
render(\TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension)
static translate($key, $extensionName, $arguments=NULL)