[!!!][TASK] Migrate EXT:context_help into EXT:backend 04/52804/7
authorGeorg Ringer <georg.ringer@gmail.com>
Mon, 15 May 2017 07:01:37 +0000 (09:01 +0200)
committerBenni Mack <benni@typo3.org>
Wed, 17 May 2017 09:16:06 +0000 (11:16 +0200)
Merge the extension into EXT:backend as it only consists of
one AJAX controller - all other functionality related to context
help is already in EXT:backend and deeply connected to Backend-related
output code, so this is just a regular step.

Resolves: #81225
Releases: master
Change-Id: Ie5d577d62876f18414b61f5eefc9d9dd48d52430
Reviewed-on: https://review.typo3.org/52804
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/backend/Classes/Controller/ContextHelpAjaxController.php [new file with mode: 0644]
typo3/sysext/backend/Classes/Utility/BackendUtility.php
typo3/sysext/backend/Configuration/Backend/AjaxRoutes.php
typo3/sysext/context_help/Classes/Controller/ContextHelpAjaxController.php [deleted file]
typo3/sysext/context_help/Configuration/Backend/AjaxRoutes.php [deleted file]
typo3/sysext/context_help/Resources/Public/Icons/Extension.png [deleted file]
typo3/sysext/context_help/composer.json [deleted file]
typo3/sysext/context_help/ext_emconf.php [deleted file]
typo3/sysext/core/Documentation/Changelog/master/Breaking-81225-MergedEXTcontext_helpToEXTbackend.rst [new file with mode: 0644]
typo3/sysext/core/Migrations/Code/ClassAliasMap.php
typo3/sysext/core/Migrations/Code/LegacyClassesForIde.php

diff --git a/typo3/sysext/backend/Classes/Controller/ContextHelpAjaxController.php b/typo3/sysext/backend/Classes/Controller/ContextHelpAjaxController.php
new file mode 100644 (file)
index 0000000..8399e0d
--- /dev/null
@@ -0,0 +1,69 @@
+<?php
+namespace TYPO3\CMS\Backend\Controller;
+
+/*
+ * 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 Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\ServerRequestInterface;
+use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Imaging\Icon;
+use TYPO3\CMS\Core\Imaging\IconFactory;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
+/**
+ * Class ContextHelpAjaxController
+ */
+class ContextHelpAjaxController
+{
+    /**
+     * The main dispatcher function. Collect data and prepare HTML output.
+     *
+     * @param ServerRequestInterface $request
+     * @param ResponseInterface $response
+     * @return ResponseInterface
+     */
+    public function getHelpAction(ServerRequestInterface $request, ResponseInterface $response)
+    {
+        $params = isset($request->getParsedBody()['params']) ? $request->getParsedBody()['params'] : $request->getQueryParams()['params'];
+        if ($params['action'] === 'getContextHelp') {
+            $result = $this->getContextHelp($params['table'], $params['field']);
+            $response->getBody()->write(json_encode([
+                'title' => $result['title'],
+                'content' => $result['description'],
+                'link' => $result['moreInfo']
+            ]));
+        }
+        return $response;
+    }
+
+    /**
+     * Fetch the context help for the given table/field parameters
+     *
+     * @param string $table Table identifier
+     * @param string $field Field identifier
+     * @return array complete Help information
+     */
+    protected function getContextHelp($table, $field)
+    {
+        $helpTextArray = BackendUtility::helpTextArray($table, $field);
+        $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
+        $moreIcon = $helpTextArray['moreInfo'] ? $iconFactory->getIcon('actions-view-go-forward', Icon::SIZE_SMALL)->render() : '';
+        return [
+            'title' => $helpTextArray['title'],
+            'description' => '<p class="t3-help-short' . ($moreIcon ? ' tipIsLinked' : '') . '">' . $helpTextArray['description'] . $moreIcon . '</p>',
+            'id' => $table . '.' . $field,
+            'moreInfo' => $helpTextArray['moreInfo']
+        ];
+    }
+}
index 82031dc..e153658 100644 (file)
@@ -2393,10 +2393,6 @@ class BackendUtility
      */
     public static function wrapInHelp($table, $field, $text = '', array $overloadHelpText = [])
     {
-        if (!ExtensionManagementUtility::isLoaded('context_help')) {
-            return $text;
-        }
-
         // Initialize some variables
         $helpText = '';
         $abbrClassAdd = '';
index 2e7a611..b314f20 100644 (file)
@@ -232,5 +232,11 @@ return [
     'records_localize' => [
         'path' => '/records/localize',
         'target' => Controller\Page\LocalizationController::class . '::localizeRecords'
+    ],
+
+    // context help
+    'context_help' => [
+        'path' => '/context-help',
+        'target' => \TYPO3\CMS\Backend\Controller\ContextHelpAjaxController::class . '::getHelpAction'
     ]
 ];
diff --git a/typo3/sysext/context_help/Classes/Controller/ContextHelpAjaxController.php b/typo3/sysext/context_help/Classes/Controller/ContextHelpAjaxController.php
deleted file mode 100644 (file)
index 5accba2..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-namespace TYPO3\CMS\ContextHelp\Controller;
-
-/*
- * 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 Psr\Http\Message\ResponseInterface;
-use Psr\Http\Message\ServerRequestInterface;
-use TYPO3\CMS\Backend\Utility\BackendUtility;
-use TYPO3\CMS\Core\Imaging\Icon;
-use TYPO3\CMS\Core\Imaging\IconFactory;
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-
-/**
- * Class ContextHelpAjaxController
- */
-class ContextHelpAjaxController
-{
-    /**
-     * The main dispatcher function. Collect data and prepare HTML output.
-     *
-     * @param ServerRequestInterface $request
-     * @param ResponseInterface $response
-     * @return ResponseInterface
-     */
-    public function getHelpAction(ServerRequestInterface $request, ResponseInterface $response)
-    {
-        $params = isset($request->getParsedBody()['params']) ? $request->getParsedBody()['params'] : $request->getQueryParams()['params'];
-        if ($params['action'] === 'getContextHelp') {
-            $result = $this->getContextHelp($params['table'], $params['field']);
-            $response->getBody()->write(json_encode([
-                'title' => $result['title'],
-                'content' => $result['description'],
-                'link' => $result['moreInfo']
-            ]));
-        }
-        return $response;
-    }
-
-    /**
-     * Fetch the context help for the given table/field parameters
-     *
-     * @param string $table Table identifier
-     * @param string $field Field identifier
-     * @return array complete Help information
-     */
-    protected function getContextHelp($table, $field)
-    {
-        $helpTextArray = BackendUtility::helpTextArray($table, $field);
-        /** @var IconFactory $iconFactory */
-        $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
-        $moreIcon = $helpTextArray['moreInfo'] ? $iconFactory->getIcon('actions-view-go-forward', Icon::SIZE_SMALL)->render() : '';
-        return [
-            'title' => $helpTextArray['title'],
-            'description' => '<p class="t3-help-short' . ($moreIcon ? ' tipIsLinked' : '') . '">' . $helpTextArray['description'] . $moreIcon . '</p>',
-            'id' => $table . '.' . $field,
-            'moreInfo' => $helpTextArray['moreInfo']
-        ];
-    }
-}
diff --git a/typo3/sysext/context_help/Configuration/Backend/AjaxRoutes.php b/typo3/sysext/context_help/Configuration/Backend/AjaxRoutes.php
deleted file mode 100644 (file)
index bb66e96..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php
-
-/**
- * Definitions for routes provided by EXT:context_help
- */
-return [
-    // Fetch data about the context help
-    'context_help' => [
-        'path' => '/context-help',
-        'target' => \TYPO3\CMS\ContextHelp\Controller\ContextHelpAjaxController::class . '::getHelpAction'
-    ]
-];
diff --git a/typo3/sysext/context_help/Resources/Public/Icons/Extension.png b/typo3/sysext/context_help/Resources/Public/Icons/Extension.png
deleted file mode 100644 (file)
index 1b5e5b2..0000000
Binary files a/typo3/sysext/context_help/Resources/Public/Icons/Extension.png and /dev/null differ
diff --git a/typo3/sysext/context_help/composer.json b/typo3/sysext/context_help/composer.json
deleted file mode 100644 (file)
index 7d094f1..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-{
-       "name": "typo3/cms-context-help",
-       "type": "typo3-cms-framework",
-       "description": "TYPO3 Core",
-       "homepage": "https://typo3.org",
-       "license": ["GPL-2.0+"],
-
-       "require": {
-               "typo3/cms-core": "*"
-       },
-       "replace": {
-               "context_help": "*"
-       },
-       "extra": {
-               "typo3/cms": {
-                       "Package": {
-                               "partOfFactoryDefault": true
-                       }
-               }
-       },
-       "autoload": {
-               "psr-4": {
-                       "TYPO3\\CMS\\ContextHelp\\": "Classes/"
-               }
-       }
-}
diff --git a/typo3/sysext/context_help/ext_emconf.php b/typo3/sysext/context_help/ext_emconf.php
deleted file mode 100644 (file)
index 696db7b..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-$EM_CONF[$_EXTKEY] = [
-    'title' => 'Context Sensitive Help',
-    'description' => 'Provides context sensitive help to tables, fields and modules in the system languages.',
-    'category' => 'be',
-    'state' => 'stable',
-    'uploadfolder' => 0,
-    'createDirs' => '',
-    'clearCacheOnLoad' => 0,
-    'author' => 'Kasper Skaarhoj',
-    'author_email' => 'kasperYYYY@typo3.com',
-    'author_company' => 'Curby Soft Multimedia',
-    'version' => '9.0.0',
-    'constraints' => [
-        'depends' => [
-            'typo3' => '9.0.0-9.0.99',
-        ],
-        'conflicts' => [],
-        'suggests' => [],
-    ],
-];
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-81225-MergedEXTcontext_helpToEXTbackend.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-81225-MergedEXTcontext_helpToEXTbackend.rst
new file mode 100644 (file)
index 0000000..d62679a
--- /dev/null
@@ -0,0 +1,32 @@
+.. include:: ../../Includes.txt
+
+=========================================================
+Breaking: #81225 - Merged EXT:context_help to EXT:backend
+=========================================================
+
+See :issue:`81225`
+
+Description
+===========
+
+The extension context_help has been merged into the extension backend.
+
+
+Impact
+======
+
+The extension backend can't be deactivated. Therefore any check if context_help is installed will return false.
+
+
+Affected Installations
+======================
+
+Installations with extensions with checks for extension context_help being installed.
+
+
+Migration
+=========
+
+Remove the checks.
+
+.. index:: Backend
index d95341e..422fa7f 100644 (file)
@@ -1,4 +1,5 @@
 <?php
 return [
-    'TYPO3\\CMS\\Lang\\LanguageService' => \TYPO3\CMS\Core\Localization\LanguageService::class
+    'TYPO3\\CMS\\Lang\\LanguageService' => \TYPO3\CMS\Core\Localization\LanguageService::class,
+    'TYPO3\\CMS\\ContextHelp\\Controller\\ContextHelpAjaxController' => \TYPO3\CMS\Backend\Controller\ContextHelpAjaxController::class
 ];
index 2bdcf10..869c201 100644 (file)
@@ -8,3 +8,9 @@ namespace TYPO3\CMS\Lang {
     {
     }
 }
+
+namespace TYPO3\CMS\ContextHelp\Controller {
+    class ContextHelpAjaxController extends \TYPO3\CMS\Backend\Controller\ContextHelpAjaxController
+    {
+    }
+}