‪TYPO3CMS  10.4
UpdateScriptViewHelper.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
26 
32 {
33 
35  protected ‪$objectManager;
36 
41  {
42  $this->objectManager = ‪$objectManager;
43  }
44 
48  public function ‪initializeArguments()
49  {
50  parent::initializeArguments();
51  $this->registerArgument('extensionKey', 'string', 'Extension key', true);
52  }
53 
59  public function ‪render()
60  {
61  $extensionKey = $this->arguments['extensionKey'];
62 
63  // If the "class.ext_update.php" file exists, build link to the update script screen
65  $updateScriptUtility = $this->objectManager->get(UpdateScriptUtility::class);
67  $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
68  if ($updateScriptUtility->checkUpdateScriptExists($extensionKey)) {
70  $uriBuilder = $this->renderingContext->getControllerContext()->getUriBuilder();
71  $action = 'show';
72  $uri = $uriBuilder->reset()->uriFor(
73  $action,
74  ['extensionKey' => $extensionKey],
75  'UpdateScript'
76  );
77  $this->tag->addAttribute('href', $uri);
78  $this->tag->addAttribute('title', ‪LocalizationUtility::translate('extensionList.update.script', 'extensionmanager'));
79  $this->tag->setContent($iconFactory->getIcon('actions-refresh', ‪Icon::SIZE_SMALL)->render());
80  $tag = $this->tag->render();
81  } else {
82  return '<span class="btn btn-default disabled">' . $iconFactory->getIcon('empty-empty', ‪Icon::SIZE_SMALL)->render() . '</span>';
83  }
84  return $tag;
85  }
86 }
‪TYPO3\CMS\Core\Imaging\Icon\SIZE_SMALL
‪const SIZE_SMALL
Definition: Icon.php:30
‪TYPO3\CMS\Extbase\Utility\LocalizationUtility
Definition: LocalizationUtility.php:33
‪TYPO3\CMS\Core\Imaging\Icon
Definition: Icon.php:26
‪TYPO3\CMS\Extensionmanager\ViewHelpers\UpdateScriptViewHelper\injectObjectManager
‪injectObjectManager(ObjectManagerInterface $objectManager)
Definition: UpdateScriptViewHelper.php:39
‪TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder
Definition: UriBuilder.php:39
‪TYPO3\CMS\Core\Imaging\IconFactory
Definition: IconFactory.php:33
‪TYPO3\CMS\Extensionmanager\Utility\UpdateScriptUtility
Definition: UpdateScriptUtility.php:27
‪TYPO3\CMS\Extbase\Object\ObjectManagerInterface
Definition: ObjectManagerInterface.php:26
‪TYPO3\CMS\Extensionmanager\ViewHelpers
‪TYPO3\CMS\Extbase\Utility\LocalizationUtility\translate
‪static string null translate(string $key, ?string $extensionName=null, array $arguments=null, string $languageKey=null, array $alternativeLanguageKeys=null)
Definition: LocalizationUtility.php:67
‪TYPO3\CMS\Extensionmanager\ViewHelpers\UpdateScriptViewHelper
Definition: UpdateScriptViewHelper.php:32
‪TYPO3\CMS\Extensionmanager\ViewHelpers\UpdateScriptViewHelper\initializeArguments
‪initializeArguments()
Definition: UpdateScriptViewHelper.php:47
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46
‪TYPO3\CMS\Extensionmanager\ViewHelpers\UpdateScriptViewHelper\render
‪string render()
Definition: UpdateScriptViewHelper.php:58
‪TYPO3\CMS\Extensionmanager\ViewHelpers\UpdateScriptViewHelper\$objectManager
‪TYPO3 CMS Extbase Object ObjectManager $objectManager
Definition: UpdateScriptViewHelper.php:34