[CLEANUP] Streamline EXT:about
[Packages/TYPO3.CMS.git] / typo3 / sysext / about / Classes / Domain / Repository / ExtensionRepository.php
1 <?php
2 namespace TYPO3\CMS\About\Domain\Repository;
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 use TYPO3\CMS\About\Domain\Model\Extension;
17 use TYPO3\CMS\Core\Package\PackageManager;
18 use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
19 use TYPO3\CMS\Extbase\Persistence\Repository;
20
21 /**
22 * Repository for TYPO3\CMS\About\Domain\Model\Extension
23 */
24 class ExtensionRepository extends Repository
25 {
26 /**
27 * Finds all loaded third-party extensions (no system extensions)
28 *
29 * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\About\Domain\Model\Extension>
30 */
31 public function findAllLoaded()
32 {
33 $loadedExtensions = $this->objectManager->get(ObjectStorage::class);
34 $packageManager = $this->objectManager->get(PackageManager::class);
35 foreach ($packageManager->getActivePackages() as $package) {
36 if ($package->getValueFromComposerManifest('type') === 'typo3-cms-extension') {
37 $extension = $this->objectManager->get(Extension::class);
38 $extension->setKey($package->getPackageKey());
39 $extension->setTitle($package->getPackageMetaData()->getDescription());
40 $extension->setAuthors($package->getValueFromComposerManifest('authors'));
41 $loadedExtensions->attach($extension);
42 }
43 }
44 return $loadedExtensions;
45 }
46 }