From 4fb61051beab519a8139922f302c83c78d2275ed Mon Sep 17 00:00:00 2001
From: Benjamin Mack <benni@typo3.org>
Date: Sun, 16 Nov 2014 12:33:07 +0100
Subject: [PATCH] [TASK] Remove dependency on EXT:cshmanual

Adding some preliminary isLoaded functions
in order to allow to uninstall EXT:cshmanual
and thus, be able to hide the full toolbar item.

The long-term solution should still be to
implement a new help concept and drop
cshmanual, the csh icon and TCA_DESCR

Releases: master
Resolves: #63146
Change-Id: I45a27ea03c75527b331fc10951047ee10fb05e28
Reviewed-on: http://review.typo3.org/34243
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
---
 typo3/sysext/backend/Classes/Template/DocumentTemplate.php  | 5 ++++-
 typo3/sysext/backend/Classes/Utility/BackendUtility.php     | 5 ++++-
 .../backend/Resources/Public/JavaScript/contexthelp.js      | 6 ++++--
 typo3/sysext/cshmanual/composer.json                        | 2 +-
 4 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/typo3/sysext/backend/Classes/Template/DocumentTemplate.php b/typo3/sysext/backend/Classes/Template/DocumentTemplate.php
index d96dbe7d2a9e..ded79e52530c 100644
--- a/typo3/sysext/backend/Classes/Template/DocumentTemplate.php
+++ b/typo3/sysext/backend/Classes/Template/DocumentTemplate.php
@@ -800,7 +800,10 @@ function jumpToUrl(URL) {
 			$this->pageRenderer->addJsFile($this->backPath . 'sysext/backend/Resources/Public/JavaScript/tab.js');
 		}
 		// Include the JS for the Context Sensitive Help
-		if ($includeCsh) {
+		// @todo: right now this is a hard dependency on csh manual, as the whole help system should be moved to
+		// the extension. The core provides a API for adding help, and rendering help, but the rendering
+		// should be up to the extension itself
+		if ($includeCsh && ExtensionManagementUtility::isLoaded('cshmanual')) {
 			$this->loadCshJavascript();
 		}
 
diff --git a/typo3/sysext/backend/Classes/Utility/BackendUtility.php b/typo3/sysext/backend/Classes/Utility/BackendUtility.php
index e6a1c930ee45..c4094dd8ce87 100644
--- a/typo3/sysext/backend/Classes/Utility/BackendUtility.php
+++ b/typo3/sysext/backend/Classes/Utility/BackendUtility.php
@@ -2562,7 +2562,10 @@ class BackendUtility {
 			$helpText = self::helpText($table, $field);
 		}
 		// If there's a help text or some overload information, proceed with preparing an output
-		if (!empty($helpText) || $hasHelpTextOverload) {
+		// @todo: right now this is a hard dependency on csh manual, as the whole help system should be moved to
+		// the extension. The core provides a API for adding help, and rendering help, but the rendering
+		// should be up to the extension itself
+		if ((!empty($helpText) || $hasHelpTextOverload) && ExtensionManagementUtility::isLoaded('cshmanual')) {
 			// If no text was given, just use the regular help icon
 			if ($text == '') {
 				$text = IconUtility::getSpriteIcon('actions-system-help-open');
diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/contexthelp.js b/typo3/sysext/backend/Resources/Public/JavaScript/contexthelp.js
index 8c19b71fb217..52dc1dd99edb 100644
--- a/typo3/sysext/backend/Resources/Public/JavaScript/contexthelp.js
+++ b/typo3/sysext/backend/Resources/Public/JavaScript/contexthelp.js
@@ -16,9 +16,11 @@ Ext.ns('TYPO3', 'TYPO3.CSH.ExtDirect');
 /**
  * Class to show tooltips for links that have the css t3-help-link
  * need the tags data-table and data-field (HTML5)
+ *
+ * @todo #1: rewrite it on jQuery base, or look for great alternatives
+ * @todo #2: make it so flexible that any extension register the JS code in backend.php and the rest should be handled via Data attributes
+ * @private please note that this javascript private API, don't depend on this code nor use it as blueprint
  */
-
-
 TYPO3.ContextHelp = function() {
 
 	/**
diff --git a/typo3/sysext/cshmanual/composer.json b/typo3/sysext/cshmanual/composer.json
index 2ce535b1f79c..8b923ba1341c 100644
--- a/typo3/sysext/cshmanual/composer.json
+++ b/typo3/sysext/cshmanual/composer.json
@@ -15,7 +15,7 @@
 	"extra": {
 		"typo3/cms": {
 			"Package": {
-				"protected": true,
+				"protected": false,
 				"partOfFactoryDefault": true,
 				"partOfMinimalUsableSystem": true
 			}
-- 
GitLab