From 4b6b0102edf3c18c09efa7f26ad2c3ea6c35f504 Mon Sep 17 00:00:00 2001
From: Koen Wouters <koen.wouters@maxserv.com>
Date: Wed, 19 Feb 2020 18:47:19 +0100
Subject: [PATCH] [FEATURE] Dashboard widget: documentation TypoScript
 Reference

A TypoScript Reference documentation widget is added.

Resolves: #90435
Releases: master
Change-Id: I31ea8a2be4bc55d6cdcecac5c9abbe95016b739e
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63323
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Daniel Siepmann <coding@daniel-siepmann.de>
Tested-by: Richard Haeser <richard@maxserv.com>
Reviewed-by: Riny van Tiggelen <info@online-gamer.nl>
Reviewed-by: Daniel Siepmann <coding@daniel-siepmann.de>
Reviewed-by: Richard Haeser <richard@maxserv.com>
---
 .../master/Feature-90333-Dashboard.rst        |  1 +
 .../DocumentationTypoScriptReference.php      | 30 +++++++++++++++++++
 .../dashboard/Configuration/Services.yaml     |  7 +++++
 .../Resources/Private/Language/locallang.xlf  | 13 ++++++++
 4 files changed, 51 insertions(+)
 create mode 100644 typo3/sysext/dashboard/Classes/Widgets/DocumentationTypoScriptReference.php

diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-90333-Dashboard.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-90333-Dashboard.rst
index d3b5f708b77f..3207c3c595bf 100644
--- a/typo3/sysext/core/Documentation/Changelog/master/Feature-90333-Dashboard.rst
+++ b/typo3/sysext/core/Documentation/Changelog/master/Feature-90333-Dashboard.rst
@@ -33,6 +33,7 @@ The following widgets are shipped by core extensions now:
 * TYPO3 news: A widget showing the latest 5 news items from typo3.org (EXT:dashboard)
 * TYPO3: This widget will show you some background information about TYPO3 and shows the current version of TYPO3 installed (EXT:dashboard)
 * Getting started with TYPO3: This widget will provide a link to the Getting Started Tutorial (EXT:dashboard)
+* TypoScript Template Reference: This widget will provide a link to the TypoScript Template Reference (EXT:dashboard)
 * TSconfig Reference: This widget will provide a link to the TSconfig Reference (EXT:dashboard)
 
 Creating your own widget
diff --git a/typo3/sysext/dashboard/Classes/Widgets/DocumentationTypoScriptReference.php b/typo3/sysext/dashboard/Classes/Widgets/DocumentationTypoScriptReference.php
new file mode 100644
index 000000000000..462bc0ae72a5
--- /dev/null
+++ b/typo3/sysext/dashboard/Classes/Widgets/DocumentationTypoScriptReference.php
@@ -0,0 +1,30 @@
+<?php
+declare(strict_types = 1);
+namespace TYPO3\CMS\Dashboard\Widgets;
+
+/*
+ * 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!
+ */
+
+/**
+ * This widget will show a link to the documentation of TYPO3 to make it easier for people
+ * to find the right documentation
+ */
+class DocumentationTypoScriptReference extends AbstractCtaButtonWidget
+{
+    protected $title = 'LLL:EXT:dashboard/Resources/Private/Language/locallang.xlf:widgets.documentation.typoscriptReference.title';
+    protected $text = 'LLL:EXT:dashboard/Resources/Private/Language/locallang.xlf:widgets.documentation.typoscriptReference.text';
+    protected $description = 'LLL:EXT:dashboard/Resources/Private/Language/locallang.xlf:widgets.documentation.typoscriptReference.description';
+    protected $label = 'LLL:EXT:dashboard/Resources/Private/Language/locallang.xlf:widgets.documentation.typoscriptReference.content.label';
+    protected $link = 'https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/Index.html';
+    protected $iconIdentifier = 'dashboard-documentation';
+}
diff --git a/typo3/sysext/dashboard/Configuration/Services.yaml b/typo3/sysext/dashboard/Configuration/Services.yaml
index c4f91955addf..bd347009aa61 100644
--- a/typo3/sysext/dashboard/Configuration/Services.yaml
+++ b/typo3/sysext/dashboard/Configuration/Services.yaml
@@ -23,6 +23,13 @@ services:
         identifier: docGettingStarted
         widgetGroups: 'typo3'
 
+  TYPO3\CMS\Dashboard\Widgets\DocumentationTypoScriptReference:
+    arguments: ['docTypoScriptReference']
+    tags:
+      - name: dashboard.widget
+        identifier: docTypoScriptReference
+        widgetGroups: 'typo3'
+
   TYPO3\CMS\Dashboard\Widgets\DocumentationTSconfigReferenceWidget:
     arguments: ['docTSconfig']
     tags:
diff --git a/typo3/sysext/dashboard/Resources/Private/Language/locallang.xlf b/typo3/sysext/dashboard/Resources/Private/Language/locallang.xlf
index 46cdb348b642..5b7bd21db11f 100644
--- a/typo3/sysext/dashboard/Resources/Private/Language/locallang.xlf
+++ b/typo3/sysext/dashboard/Resources/Private/Language/locallang.xlf
@@ -92,6 +92,19 @@
 				<source>Getting Started Tutorial</source>
  			</trans-unit>
 
+			<trans-unit id="widgets.documentation.typoscriptReference.title" xml:space="preserve">
+				<source>TypoScript Template Reference</source>
+ 			</trans-unit>
+			<trans-unit id="widgets.documentation.typoscriptReference.description" xml:space="preserve">
+				<source>Add a shortcut to the TYPO3 TypoScript Template Reference.</source>
+ 			</trans-unit>
+			<trans-unit id="widgets.documentation.typoscriptReference.text" xml:space="preserve">
+				<source>This document is a reference, used to lookup TypoScript templating.</source>
+ 			</trans-unit>
+			<trans-unit id="widgets.documentation.typoscriptReference.content.label" xml:space="preserve">
+				<source>TypoScript Template Reference</source>
+ 			</trans-unit>
+
 			<trans-unit id="widgets.documentation.TSconfigReference.title" xml:space="preserve">
 				<source>TSconfig Reference</source>
  			</trans-unit>
-- 
GitLab