TYPO3 CMS  TYPO3_7-6
UpdateScriptViewHelper.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 {
30  protected $objectManager;
31 
35  public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager)
36  {
37  $this->objectManager = $objectManager;
38  }
39 
46  public function render($extensionKey)
47  {
48  $tag = '';
49 
50  // If the "class.ext_update.php" file exists, build link to the update script screen
52  $updateScriptUtility = $this->objectManager->get(\TYPO3\CMS\Extensionmanager\Utility\UpdateScriptUtility::class);
54  $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
55  if ($updateScriptUtility->checkUpdateScriptExists($extensionKey)) {
56  $uriBuilder = $this->controllerContext->getUriBuilder();
57  $action = 'show';
58  $uri = $uriBuilder->reset()->uriFor(
59  $action,
60  ['extensionKey' => $extensionKey],
61  'UpdateScript'
62  );
63  $this->tag->addAttribute('href', $uri);
64  $this->tag->addAttribute('title', \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('extensionList.update.script', 'extensionmanager'));
65  $this->tag->setContent($iconFactory->getIcon('extensions-extensionmanager-update-script', Icon::SIZE_SMALL)->render());
66  $tag = $this->tag->render();
67  } else {
68  return '<span class="btn btn-default disabled">' . $iconFactory->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>';
69  }
70  return $tag;
71  }
72 }
static translate($key, $extensionName, $arguments=null)
injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager)