TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
ExtensionManager.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Documentation\Slots;
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 
55  public function processActions(array $extension, array &$actions)
56  {
57  if (static::$documents === null) {
59  $documentController = $this->objectManager->get(\TYPO3\CMS\Documentation\Controller\DocumentController::class);
60  static::$documents = $documentController->getDocuments();
61  }
62 
63  $extensionKey = $extension['key'];
64  $documentKey = 'typo3cms.extensions.' . $extensionKey;
65 
66  if (isset(static::$documents[$documentKey])) {
67  $document = static::$documents[$documentKey];
68 
69  foreach ($document->getTranslations() as $documentTranslation) {
70  $actions[] = FormatsViewHelper::renderStatic(
71  [
72  'documentTranslation' => $documentTranslation,
73  ],
74  function () {
75  },
76  new RenderingContext()
77  );
78  }
79  } else {
80  $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
81  $emptyIcon = $iconFactory->getIcon('empty-empty', Icon::SIZE_SMALL)->render();
82  $actions[] = '<span class="btn btn-default disabled">' . $emptyIcon . '</span>';
83  $actions[] = '<span class="btn btn-default disabled">' . $emptyIcon . '</span>';
84  $actions[] = '<span class="btn btn-default disabled">' . $emptyIcon . '</span>';
85  }
86  }
87 }
static makeInstance($className,...$constructorArguments)
injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager)