[FEATURE] Signal to process actions in Extension Manager 47/28347/2
authorXavier Perseguers <xavier@typo3.org>
Thu, 13 Mar 2014 13:10:26 +0000 (14:10 +0100)
committerXavier Perseguers <xavier@typo3.org>
Thu, 13 Mar 2014 16:01:04 +0000 (17:01 +0100)
This adds a way for third party extensions to process
extensions' available actions in Extension Manager.

Resolves: #56869
Releases: 6.2
Change-Id: I7cbacba7fccfd3178dc1265ad69bf5dec531cf70
Reviewed-on: https://review.typo3.org/28347
Reviewed-by: Georg Ringer
Tested-by: Georg Ringer
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
typo3/sysext/extensionmanager/Classes/ViewHelpers/ProcessAvailableActionsViewHelper.php [new file with mode: 0644]
typo3/sysext/extensionmanager/Resources/Private/Templates/List/Index.html

diff --git a/typo3/sysext/extensionmanager/Classes/ViewHelpers/ProcessAvailableActionsViewHelper.php b/typo3/sysext/extensionmanager/Classes/ViewHelpers/ProcessAvailableActionsViewHelper.php
new file mode 100644 (file)
index 0000000..6589000
--- /dev/null
@@ -0,0 +1,68 @@
+<?php
+namespace TYPO3\CMS\Extensionmanager\ViewHelpers;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2014 Xavier Perseguers <xavier@typo3.org>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the text file GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * View helper to let 3rd-party extensions process the list of available
+ * actions for a given extension.
+ *
+ * @author Xavier Perseguers <xavier@typo3.org>
+ */
+class ProcessAvailableActionsViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Link\ActionViewHelper {
+
+       const SIGNAL_ProcessActions = 'processActions';
+
+       /**
+        * @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher
+        * @inject
+        */
+       protected $signalSlotDispatcher;
+
+       /**
+        * Processes the list of actions.
+        *
+        * @param string $extension
+        * @return string the rendered list of actions
+        */
+       public function render($extension) {
+               $html = $this->renderChildren();
+               $actions = preg_split('#\\n\\s*#s', trim($html));
+
+               $this->signalSlotDispatcher->dispatch(
+                       __CLASS__,
+                       static::SIGNAL_ProcessActions,
+                       array(
+                               'extension' => $extension,
+                               'actions' => &$actions,
+                       )
+               );
+
+               return implode(' ', $actions);
+       }
+
+}
index 673035c..af152d9 100644 (file)
                                        {extension.version}
                                </td>
                                <td class="icons">
-                                       <em:configureExtension extension="{extension}"><f:be.buttons.icon icon="actions-system-extension-configure" title="{f:translate(key:'extensionList.configure')}" /></em:configureExtension>
-                                       <em:updateScript extensionKey="{extension.key}" />
-                                       <em:removeExtension extension="{extension}" />
-                                       <f:be.buttons.icon uri="{f:uri.action(action:'downloadExtensionZip',controller:'Action',arguments:'{extension:extension.key}')}" icon="actions-system-extension-download" title="{f:translate(key:'extensionList.downloadzip')}"/>
-                                       <em:downloadExtensionData extension="{extension}" />
+                                       <em:processAvailableActions extension="{extension}">
+                                               <em:configureExtension extension="{extension}"><f:be.buttons.icon icon="actions-system-extension-configure" title="{f:translate(key:'extensionList.configure')}" /></em:configureExtension>
+                                               <em:updateScript extensionKey="{extension.key}" />
+                                               <em:removeExtension extension="{extension}" />
+                                               <f:be.buttons.icon uri="{f:uri.action(action:'downloadExtensionZip',controller:'Action',arguments:'{extension:extension.key}')}" icon="actions-system-extension-download" title="{f:translate(key:'extensionList.downloadzip')}"/>
+                                               <em:downloadExtensionData extension="{extension}" />
+                                       </em:processAvailableActions>
                                </td>
                                <td class="state {extension.state}">
                                        {extension.state}