-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] Add dashboard widget for quick access of the project docume…
…ntation
- Loading branch information
Showing
3 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace GeorgRinger\Doc\Widgets\Provider; | ||
|
||
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; | ||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
use TYPO3\CMS\Dashboard\Widgets\ButtonProviderInterface; | ||
|
||
/** | ||
* Provide link for project documentation. | ||
* Check whether EXT:doc is enabled and add link to module. | ||
* No link is returned if not enabled. | ||
*/ | ||
class ExtDocButtonProvider implements ButtonProviderInterface | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $title; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $target; | ||
|
||
public function __construct(string $title, string $target = '') | ||
{ | ||
$this->title = $title; | ||
$this->target = $target; | ||
} | ||
|
||
public function getTitle(): string | ||
{ | ||
return $this->title; | ||
} | ||
|
||
public function getLink(): string | ||
{ | ||
if (ExtensionManagementUtility::isLoaded('doc')) { | ||
return 'javascript:top.goToModule(' . GeneralUtility::quoteJSvalue('help_doc') . ');'; | ||
} | ||
|
||
return ''; | ||
} | ||
|
||
public function getTarget(): string | ||
{ | ||
return $this->target; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace GeorgRinger\Doc; | ||
|
||
use GeorgRinger\Doc\Widgets\Provider\ExtDocButtonProvider; | ||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; | ||
use Symfony\Component\DependencyInjection\Reference; | ||
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; | ||
use TYPO3\CMS\Dashboard\Widgets\CtaWidget; | ||
|
||
return function (ContainerConfigurator $configurator) { | ||
$services = $configurator->services(); | ||
|
||
if (ExtensionManagementUtility::isLoaded('dashboard')) { | ||
$services->set('dashboard.widget.gotoProjectDocumentation') | ||
->class(CtaWidget::class) | ||
->arg('$view', new Reference('dashboard.views.widget')) | ||
->arg('$buttonProvider', new Reference(ExtDocButtonProvider::class)) | ||
->arg('$options', ['text' => 'LLL:EXT:doc/Resources/Private/Language/locallang.xlf:widget.text']) | ||
->tag('dashboard.widget', [ | ||
'identifier' => 'gotoProjectDocumentation', | ||
'groupNames' => 'documentation', | ||
'title' => 'LLL:EXT:doc/Resources/Private/Language/locallang.xlf:widget.title', | ||
'description' => 'LLL:EXT:doc/Resources/Private/Language/locallang.xlf:widget.description', | ||
'iconIdentifier' => 'content-widget-text', | ||
'height' => 'small' | ||
]) | ||
; | ||
|
||
$services->set('GeorgRinger\Doc\Widgets\Provider\ExtDocButtonProvider') | ||
->arg('$title', 'LLL:EXT:doc/Resources/Private/Language/locallang.xlf:widget.buttonText') | ||
; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<xliff version="1.0" xmlns:t3="http://typo3.org/schemas/xliff"> | ||
<file t3:id="1609228987" source-language="en" datatype="plaintext" original="EXT:doc/Resources/Private/Language/locallang.xlf" product-name="doc"> | ||
<header/> | ||
<body> | ||
<trans-unit id="widget.title" resname="widget.title"> | ||
<source>Project Documentation</source> | ||
</trans-unit> | ||
<trans-unit id="widget.description" resname="widget.description"> | ||
<source>Add a shortcut to the project documentation.</source> | ||
</trans-unit> | ||
<trans-unit id="widget.text" resname="widget.text"> | ||
<source>The project documentation is the first place to go for all questions about this TYPO3 installation.</source> | ||
</trans-unit> | ||
<trans-unit id="widget.buttonText" resname="widget.buttonText"> | ||
<source>Show Project Documentation</source> | ||
</trans-unit> | ||
</body> | ||
</file> | ||
</xliff> |