TYPO3 CMS  TYPO3_7-6
ConfigureExtensionViewHelper.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 
21 
27 {
36  public function render($extension, $forceConfiguration = true, $showDescription = false)
37  {
38  $content = (string)$this->renderChildren();
39  if ($extension['installed'] && file_exists(PATH_site . $extension['siteRelPath'] . 'ext_conf_template.txt')) {
40  $uriBuilder = $this->controllerContext->getUriBuilder();
41  $action = 'showConfigurationForm';
42  $uri = $uriBuilder->reset()->uriFor(
43  $action,
44  ['extension' => ['key' => $extension['key']]],
45  'Configuration'
46  );
47  if ($showDescription) {
48  $title = $extension['description'] . PHP_EOL .
49  LocalizationUtility::translate('extensionList.clickToConfigure', 'extensionmanager');
50  } else {
51  $title = LocalizationUtility::translate('extensionList.configure', 'extensionmanager');
52  }
53  $this->tag->addAttribute('href', $uri);
54  $this->tag->addAttribute('title', $title);
55  $this->tag->setContent($content);
56  $content = $this->tag->render();
57  } elseif ($forceConfiguration) {
58  $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
59  $content = '<span class="btn btn-default disabled">' . $iconFactory->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>';
60  } else {
61  $content = '<span title="' . htmlspecialchars($extension['description']) . '">' . $content . '</span>';
62  }
63 
64  return $content;
65  }
66 }
static translate($key, $extensionName, $arguments=null)
render($extension, $forceConfiguration=true, $showDescription=false)