TYPO3 CMS  TYPO3_8-7
DownloadExtensionDataViewHelper.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
20 
26 {
32  public function initializeArguments()
33  {
34  parent::initializeArguments();
35  $this->registerArgument('extension', 'array', '', true);
36  }
37 
43  public function render()
44  {
45  $extension = $this->arguments['extension'];
47  $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
48 
49  $filePrefix = PATH_site . $extension['siteRelPath'];
50  if (!file_exists(($filePrefix . 'ext_tables.sql')) && !file_exists(($filePrefix . 'ext_tables_static+adt.sql'))) {
51  return '<span class="btn btn-default disabled">' . $iconFactory->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>';
52  }
53  $uriBuilder = $this->controllerContext->getUriBuilder();
54  $uriBuilder->reset();
55  $uri = $uriBuilder->uriFor('downloadExtensionData', [
56  'extension' => $extension['key']
57  ], 'Action');
58  $this->tag->addAttribute('href', $uri);
59  $cssClass = 'downloadExtensionData btn btn-default';
60  $this->tag->addAttribute('class', $cssClass);
61  $this->tag->addAttribute('title', \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('extensionList.downloadsql', 'extensionmanager'));
62  $this->tag->setContent($iconFactory->getIcon('actions-system-extension-sqldump', Icon::SIZE_SMALL)->render());
63  return $this->tag->render();
64  }
65 }
static translate($key, $extensionName=null, $arguments=null)
static makeInstance($className,... $constructorArguments)