[TASK] Move check if workspaces extension is loaded to the controller 19/55719/2
authorGeorg Ringer <georg.ringer@gmail.com>
Wed, 14 Feb 2018 16:11:55 +0000 (17:11 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 14 Feb 2018 21:36:20 +0000 (22:36 +0100)
Instead of using a ViewHelper the logic can be moved to the controller
where it belongs.

As the ViewHelper is not a public API it can be dropped without a
RST file.

Resolves: #83900
Releases: master
Change-Id: I8d089761b8a168f00cb0739742fa658d40687379
Reviewed-on: https://review.typo3.org/55719
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Tested-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/belog/Classes/Controller/AbstractController.php
typo3/sysext/belog/Classes/ViewHelpers/IsExtensionLoadedViewHelper.php [deleted file]
typo3/sysext/belog/Resources/Private/Partials/Content/Filter.html

index effdec1..e08b82c 100644 (file)
@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Belog\Controller;
  */
 
 use TYPO3\CMS\Backend\View\BackendTemplateView;
+use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
 use TYPO3\CMS\Extbase\Mvc\View\ViewInterface;
 use TYPO3\CMS\Extbase\Property\TypeConverter\PersistentObjectConverter;
@@ -165,6 +166,7 @@ abstract class AbstractController extends ActionController
         $this->forceWorkspaceSelectionIfInWorkspace($constraint);
         $logEntries = $this->logEntryRepository->findByConstraint($constraint);
         $groupedLogEntries = $this->groupLogEntriesByPageAndDay($logEntries, $constraint->getGroupByPage());
+        $this->view->assign('workspacesExtensionLoaded', ExtensionManagementUtility::isLoaded('workspaces'));
         $this->view->assign('groupedLogEntries', $groupedLogEntries)->assign('constraint', $constraint)->assign('userGroups', $this->createUserAndGroupListForSelectOptions())->assign('workspaces', $this->createWorkspaceListForSelectOptions())->assign('pageDepths', $this->createPageDepthOptions());
     }
 
diff --git a/typo3/sysext/belog/Classes/ViewHelpers/IsExtensionLoadedViewHelper.php b/typo3/sysext/belog/Classes/ViewHelpers/IsExtensionLoadedViewHelper.php
deleted file mode 100644 (file)
index c37dd73..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-<?php
-namespace TYPO3\CMS\Belog\ViewHelpers;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
-use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
-use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
-use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
-
-/**
- * Returns true, if a specific extension is loaded
- * @internal
- */
-class IsExtensionLoadedViewHelper extends AbstractViewHelper
-{
-    use CompileWithRenderStatic;
-
-    /**
-     * Initializes the arguments
-     */
-    public function initializeArguments()
-    {
-        $this->registerArgument('extensionKey', 'string', 'The extension\'s key', true);
-    }
-
-    /**
-     * Checks whether an extension is loaded.
-     *
-     * @param array $arguments
-     * @param \Closure $renderChildrenClosure
-     * @param RenderingContextInterface $renderingContext
-     *
-     * @return bool TRUE if extension is loaded, FALSE otherwise
-     */
-    public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
-    {
-        return ExtensionManagementUtility::isLoaded($arguments['extensionKey']);
-    }
-}
index 9a0b546..a828245 100644 (file)
@@ -35,7 +35,7 @@
                />
        </div>
 
-       <f:if condition="{belog:isExtensionLoaded(extensionKey:'workspaces')}">
+       <f:if condition="{workspacesExtensionLoaded}">
                <f:if condition="{showWorkspaceSelector}">
                                <div class="form-group">
                                        <label for="belog-workspaces"><f:translate key="workspace" /></label>