TYPO3  7.6
ConfigureExtensionViewHelper.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Extensionmanager\ViewHelpers;
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 $tagName = 'a';
31 
40  public function render($extension, $forceConfiguration = true, $showDescription = false)
41  {
42  $content = (string)$this->renderChildren();
43  if ($extension['installed'] && file_exists(PATH_site . $extension['siteRelPath'] . 'ext_conf_template.txt')) {
44  $uriBuilder = $this->controllerContext->getUriBuilder();
45  $action = 'showConfigurationForm';
46  $uri = $uriBuilder->reset()->uriFor(
47  $action,
48  array('extension' => array('key' => $extension['key'])),
49  'Configuration'
50  );
51  if ($showDescription) {
52  $title = $extension['description'] . PHP_EOL .
53  \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('extensionList.clickToConfigure', 'extensionmanager');
54  } else {
55  $title = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('extensionList.configure', 'extensionmanager');
56  }
57  $this->tag->addAttribute('href', $uri);
58  $this->tag->addAttribute('title', $title);
59  $this->tag->setContent($content);
60  $content = $this->tag->render();
61  } elseif ($forceConfiguration) {
62  $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
63  $content = '<span class="btn btn-default disabled">' . $iconFactory->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>';
64  }
65 
66  return $content;
67  }
68 }