/** * Renders a download link * * @param \TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension * @return string the rendered a tag */ public function render(\TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension) { $installPaths = \TYPO3\CMS\Extensionmanager\Domain\Model\Extension::returnAllowedInstallPaths(); if (empty($installPaths)) { return ''; } $pathSelector = '<ul class="is-hidden">'; foreach ($installPaths as $installPathType => $installPath) { $pathSelector .= '<li> <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"' : '') . '/> <label for="' . htmlspecialchars($extension->getExtensionKey()) . '-downloadPath-' . htmlspecialchars($installPathType) . '">' . htmlspecialchars($installPathType) . '</label> </li>'; } $pathSelector .= '</ul>'; $uriBuilder = $this->controllerContext->getUriBuilder(); $action = 'checkDependencies'; $uriBuilder->reset(); $uriBuilder->setFormat('json'); $uri = $uriBuilder->uriFor($action, array('extension' => (int) $extension->getUid()), 'Download'); $this->tag->addAttribute('data-href', $uri); $label = ' <div class="btn-group"> <button title="' . LocalizationUtility::translate('extensionList.downloadViewHelper.submit', 'extensionmanager') . '" type="submit" class="btn btn-default" value="' . LocalizationUtility::translate('extensionList.downloadViewHelper.submit', 'extensionmanager') . '" > <span class="t3-icon fa fa-cloud-download"></span> </button> </div>'; $this->tag->setContent($label . $pathSelector); $this->tag->addAttribute('class', 'download'); return '<div id="' . htmlspecialchars($extension->getExtensionKey()) . '-downloadFromTer" class="downloadFromTer">' . $this->tag->render() . '</div>'; }
/** * Renders a download link * * @param \TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension * @return string the rendered a tag */ public function render(\TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension) { $installPaths = \TYPO3\CMS\Extensionmanager\Domain\Model\Extension::returnAllowedInstallPaths(); $pathSelector = '<ul>'; foreach ($installPaths as $installPathType => $installPath) { $pathSelector .= '<li> <input type="radio" id="' . $extension->getExtensionKey() . '-downloadPath-' . $installPathType . '" name="' . $this->getFieldNamePrefix('downloadPath') . '[downloadPath]" class="downloadPath" value="' . $installPathType . '"' . ($installPathType == 'Local' ? 'checked="checked"' : '') . '/> <label for="' . $extension->getExtensionKey() . '-downloadPath-' . $installPathType . '">' . $installPathType . '</label> </li>'; } $pathSelector .= '</ul>'; $uriBuilder = $this->controllerContext->getUriBuilder(); $action = 'checkDependencies'; $uriBuilder->reset(); $uriBuilder->setFormat('json'); $uri = $uriBuilder->uriFor($action, array('extension' => $extension->getUid()), 'Download'); $this->tag->addAttribute('href', $uri); $label = '<input type="submit" value="Import and Install" />'; $this->tag->setContent($label . $pathSelector); $this->tag->addAttribute('class', 'download'); return '<div id="' . $extension->getExtensionKey() . '-downloadFromTer" class="downloadFromTer">' . $this->tag->render() . '</div>'; }
/** * Downloads the extension the user wants to install * This is separated from downloading the dependencies * as an extension is able to provide it's own dependencies * * @param Extension $extension * @return void */ public function downloadMainExtension(Extension $extension) { // The extension object has a uid if the extension is not present in the system // or an update of a present extension is triggered. if ($extension->getUid()) { $this->downloadUtility->download($extension); } }