TYPO3 CMS  TYPO3_8-7
ExtensionManager.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 
22 
28 {
32  protected static $documents = null;
33 
37  protected $objectManager;
38 
42  public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager)
43  {
44  $this->objectManager = $objectManager;
45  }
46 
54  public function processActions(array $extension, array &$actions)
55  {
56  if (static::$documents === null) {
58  $documentController = $this->objectManager->get(\TYPO3\CMS\Documentation\Controller\DocumentController::class);
59  static::$documents = $documentController->getDocuments();
60  }
61 
62  $extensionKey = $extension['key'];
63  $documentKey = 'typo3cms.extensions.' . $extensionKey;
64 
65  if (isset(static::$documents[$documentKey])) {
66  $document = static::$documents[$documentKey];
67 
68  foreach ($document->getTranslations() as $documentTranslation) {
69  $actions[] = FormatsViewHelper::renderStatic(
70  [
71  'documentTranslation' => $documentTranslation,
72  ],
73  function () {
74  },
75  new RenderingContext()
76  );
77  }
78  } else {
79  $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
80  $emptyIcon = $iconFactory->getIcon('empty-empty', Icon::SIZE_SMALL)->render();
81  $actions[] = '<span class="btn btn-default disabled">' . $emptyIcon . '</span>';
82  $actions[] = '<span class="btn btn-default disabled">' . $emptyIcon . '</span>';
83  $actions[] = '<span class="btn btn-default disabled">' . $emptyIcon . '</span>';
84  }
85  }
86 }
static makeInstance($className,... $constructorArguments)
injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager)