[BUGFIX] about - inject object manager only once 97/45497/2
authorDaniel Goerz <ervaude@gmail.com>
Fri, 25 Dec 2015 15:42:19 +0000 (16:42 +0100)
committerMorton Jonuschat <m.jonuschat@mojocode.de>
Wed, 30 Dec 2015 07:34:17 +0000 (08:34 +0100)
Additionally the div containing credits for developers
of loaded extensions is not rendered anymore if no
extensions are loaded.

Change-Id: I00f748281ef6d435f00996b228c9e3583babcdc5
Resolves: #72440
Releases: master,7.6
Reviewed-on: https://review.typo3.org/45441
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
(cherry picked from commit 2b1d71d373c8af1254b5fdce2d4ae3f94f506239)
Reviewed-on: https://review.typo3.org/45497

typo3/sysext/about/Classes/Domain/Repository/ExtensionRepository.php
typo3/sysext/about/Resources/Private/Partials/Extensions.html

index 3934a53..c3c7543 100644 (file)
@@ -13,40 +13,30 @@ namespace TYPO3\CMS\About\Domain\Repository;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\About\Domain\Model\Extension;
+use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
+use TYPO3\CMS\Extbase\Persistence\Repository;
 
 /**
  * Repository for TYPO3\CMS\About\Domain\Model\Extension
  */
-class ExtensionRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
+class ExtensionRepository extends Repository
 {
     /**
-     * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
-     */
-    protected $objectManager;
-
-    /**
-     * @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager
-     */
-    public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager)
-    {
-        $this->objectManager = $objectManager;
-    }
-
-    /**
      * Finds all loaded extensions
      *
      * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\About\Domain\Model\Extension>
      */
     public function findAllLoaded()
     {
-        $loadedExtensions = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class);
+        $loadedExtensions = $this->objectManager->get(ObjectStorage::class);
         $loadedExtensionsArray = $GLOBALS['TYPO3_LOADED_EXT'];
         foreach ($loadedExtensionsArray as $extensionKey => $extension) {
-            if ((is_array($extension) || $extension instanceof \ArrayAccess) && $extension['type'] != 'S') {
+            if ((is_array($extension) || $extension instanceof \ArrayAccess) && $extension['type'] !== 'S') {
                 $emconfPath = PATH_site . $extension['siteRelPath'] . 'ext_emconf.php';
                 if (file_exists($emconfPath)) {
                     include $emconfPath;
-                    $extension = $this->objectManager->get(\TYPO3\CMS\About\Domain\Model\Extension::class);
+                    $extension = $this->objectManager->get(Extension::class);
                     $extension->setKey($extensionKey);
                     $extension->setTitle($EM_CONF['']['title']);
                     $extension->setAuthor($EM_CONF['']['author']);
index 91fe406..fadcf31 100644 (file)
@@ -1,30 +1,32 @@
-<div>
-       <h2>
-               <f:translate key="LLL:EXT:lang/locallang_mod_help_about.xlf:extension_authors" />
-       </h2>
-       <p>
-               <f:translate key="LLL:EXT:lang/locallang_mod_help_about.xlf:extension_list_info" />
-       </p>
-       <br/>
-       <table border="0" cellspacing="2" cellpadding="1">
-               <tr>
-                       <th><f:translate key="LLL:EXT:lang/locallang_mod_help_about.xlf:extension" /></th>
-                       <th><f:translate key="LLL:EXT:lang/locallang_mod_help_about.xlf:extension_author" /></th>
-               </tr>
-
-               <f:for each="{loadedExtensions}" as="loadedExtension">
+<f:if condition="{loadedExtensions}">
+       <div>
+               <h2>
+                       <f:translate key="LLL:EXT:lang/locallang_mod_help_about.xlf:extension_authors" />
+               </h2>
+               <p>
+                       <f:translate key="LLL:EXT:lang/locallang_mod_help_about.xlf:extension_list_info" />
+               </p>
+               <br/>
+               <table border="0" cellspacing="2" cellpadding="1">
                        <tr>
-                               <td width="280">
-                                       {loadedExtension.title} ({loadedExtension.key})
-                               </td>
-                               <td>
-                                       <f:link.email
-                                               email="{loadedExtension.authorEmail}?subject={f:format.urlencode(value:'Thanks for your {loadedExtension.title} extension')}"
-                                       >
-                                               {loadedExtension.author}
-                                       </f:link.email>
-                               </td>
+                               <th><f:translate key="LLL:EXT:lang/locallang_mod_help_about.xlf:extension" /></th>
+                               <th><f:translate key="LLL:EXT:lang/locallang_mod_help_about.xlf:extension_author" /></th>
                        </tr>
-               </f:for>
-       </table>
-</div>
+
+                       <f:for each="{loadedExtensions}" as="loadedExtension">
+                               <tr>
+                                       <td width="280">
+                                               {loadedExtension.title} ({loadedExtension.key})
+                                       </td>
+                                       <td>
+                                               <f:link.email
+                                                       email="{loadedExtension.authorEmail}?subject={f:format.urlencode(value:'Thanks for your {loadedExtension.title} extension')}"
+                                               >
+                                                       {loadedExtension.author}
+                                               </f:link.email>
+                                       </td>
+                               </tr>
+                       </f:for>
+               </table>
+       </div>
+</f:if>