Commit df8049ea authored by Georg Ringer's avatar Georg Ringer Committed by Benni Mack
Browse files

[FEATURE] Show link to online docs in extension manager

The export of extensions provided by https://extensions.typo3.org
has been extended with the link to the documentation.

This link is now shown in the list and detail view of extensions
in the extensions manager.

Resolves: #89458
Releases: master
Change-Id: If1439bd7b97d9c60c2811716edef97a6e4ed870d
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62032

Tested-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent 538bb7cb
.. include:: ../../Includes.txt
===============================================================
Feature: #89458 - Show link to online docs in extension manager
===============================================================
See :issue:`89458`
Description
===========
The export of extensions provided by https://extensions.typo3.org has been extended with the link
to the documentation of an extension. This link is now shown in the list of extension as well as the detail view
of extensions in the extension manager.
Impact
======
Extension authors can add a custom link to the manual in their TER extensions which is now shown in the TYPO3 backend.
.. index:: Backend, ext:extensionmanager
......@@ -152,6 +152,11 @@ class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
*/
protected $dependencies;
/**
* @var string
*/
protected $documentationLink = '';
/**
* @internal
* @var int
......@@ -599,4 +604,20 @@ class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
return $this->alldownloadcounter;
}
/**
* @return string
*/
public function getDocumentationLink(): string
{
return $this->documentationLink;
}
/**
* @param string $documentationLink
*/
public function setDocumentationLink(string $documentationLink): void
{
$this->documentationLink = $documentationLink;
}
}
......@@ -71,7 +71,8 @@ class ExtensionListUtility implements \SplObserver
'category',
'description',
'serialized_dependencies',
'update_comment'
'update_comment',
'documentation_link'
];
/**
......@@ -251,7 +252,8 @@ class ExtensionListUtility implements \SplObserver
$this->extensionModel->getCategoryIndexFromStringOrNumber($subject->getCategory() ?: ''),
$subject->getDescription() ?: '',
$subject->getDependencies() ?: '',
$subject->getUploadcomment() ?: ''
$subject->getUploadcomment() ?: '',
$subject->getDocumentationLink() ?: '',
];
++$this->sumRecords;
}
......
......@@ -139,6 +139,13 @@ abstract class AbstractExtensionXmlParser extends AbstractXmlParser
*/
protected $versionDownloadCounter;
/**
* Link to the documentation
*
* @var string
*/
protected $documentationLink;
/**
* Returns an associative array of all extension version properties.
*
......@@ -169,6 +176,7 @@ abstract class AbstractExtensionXmlParser extends AbstractXmlParser
$versionProperties['authorcompany'] = $this->authorcompany;
$versionProperties['ownerusername'] = $this->ownerusername;
$versionProperties['t3xfilemd5'] = $this->t3xfilemd5;
$versionProperties['documentationlink'] = $this->documentationLink;
return $versionProperties;
}
......@@ -359,6 +367,14 @@ abstract class AbstractExtensionXmlParser extends AbstractXmlParser
return $this->version;
}
/**
* @return string
*/
public function getDocumentationLink()
{
return $this->documentationLink;
}
/**
* Method resets version class properties.
*
......@@ -369,7 +385,7 @@ abstract class AbstractExtensionXmlParser extends AbstractXmlParser
// resetting at least class property "version" is mandatory
// as we need to do some magic in regards to
// an extension's and version's child node "downloadcounter"
$this->version = $this->title = $this->versionDownloadCounter = $this->description = $this->state = $this->reviewstate = $this->category = $this->lastuploaddate = $this->uploadcomment = $this->dependencies = $this->authorname = $this->authoremail = $this->authorcompany = $this->ownerusername = $this->t3xfilemd5 = null;
$this->version = $this->title = $this->versionDownloadCounter = $this->description = $this->state = $this->reviewstate = $this->category = $this->lastuploaddate = $this->uploadcomment = $this->dependencies = $this->authorname = $this->authoremail = $this->authorcompany = $this->ownerusername = $this->t3xfilemd5 = $this->documentationLink = null;
if ($resetAll) {
$this->extensionKey = $this->extensionDownloadCounter = null;
}
......
......@@ -133,6 +133,9 @@ class ExtensionXmlPullParser extends AbstractExtensionXmlParser
case 't3xfilemd5':
$this->t3xfilemd5 = $this->getElementValue($elementName);
break;
case 'documentation_link':
$this->documentationLink = $this->getElementValue($elementName);
break;
}
}
......
......@@ -168,6 +168,9 @@ class ExtensionXmlPushParser extends AbstractExtensionXmlParser
case 't3xfilemd5':
$this->t3xfilemd5 = $this->elementData;
break;
case 'documentation_link':
$this->documentationLink = $this->elementData;
break;
}
}
......
......@@ -12,7 +12,7 @@ return [
]
],
'interface' => [
'showRecordFieldList' => 'extension_key,version,integer_version,title,description,state,category,last_updated,update_comment,author_name,author_email,md5hash,serialized_dependencies'
'showRecordFieldList' => 'extension_key,version,integer_version,title,description,state,category,last_updated,update_comment,author_name,author_email,md5hash,serialized_dependencies,documentation_link'
],
'columns' => [
'extension_key' => [
......@@ -132,9 +132,15 @@ return [
'size' => 30,
],
],
'documentation_link' => [
'label' => 'LLL:EXT:extensionmanager/Resources/Private/Language/locallang_db.xlf:tx_extensionmanager_domain_model_extension.documentation_link',
'config' => [
'type' => 'input',
],
],
],
'types' => [
'0' => ['showitem' => 'extensionkey, version, integer_version, title, description, state, category, last_updated, update_comment, author_name, author_email, review_state, md5hash, serialized_dependencies']
'0' => ['showitem' => 'extensionkey, version, integer_version, title, description, state, category, last_updated, update_comment, author_name, author_email, review_state, md5hash, serialized_dependencies, documentation_link']
],
'palettes' => [
'1' => ['showitem' => '']
......
......@@ -141,6 +141,9 @@
<trans-unit id="extensionList.header.author" resname="extensionList.header.author">
<source>Author</source>
</trans-unit>
<trans-unit id="extensionList.header.manual" resname="extensionList.header.manual">
<source>Manual</source>
</trans-unit>
<trans-unit id="searchTemplate.searchExtensions" resname="searchTemplate.searchExtensions">
<source>Search extensions</source>
</trans-unit>
......
......@@ -31,6 +31,13 @@
<div class="author-email">{extension.authorEmail}</div>
</div>
</td>
<td>
<f:if condition="{extension.documentationLink}">
<a href="{extension.documentationLink}" class="btn btn-default" target="_blank" rel="noreferrer" title="{f:translate(key: 'extensionList.showAllVersions.readOnline')}">
<core:icon identifier="actions-system-extension-documentation" size="small" />
</a>
</f:if>
</td>
<td>
<span class="label label-{extension.stateString}">{extension.stateString}</span>
</td>
......@@ -7,6 +7,7 @@
<th><f:translate key="extensionList.header.version"/></th>
<th><f:translate key="extensionList.header.lastUpdate"/></th>
<th><f:translate key="extensionList.header.description"/></th>
<th><f:translate key="extensionList.header.manual"/></th>
<th><f:translate key="extensionList.header.extensionState"/></th>
</tr>
</thead>
......
......@@ -47,7 +47,7 @@
<tr class="ter-ext-single-info-manual">
<th><f:translate key="extensionList.showAllVersions.manual" /></th>
<td>
<a href="https://docs.typo3.org/typo3cms/extensions/{currentVersion.extensionKey}/" target="_blank" rel="noopener noreferrer">
<a href="{f:if(condition:currentVersion.documentationLink,then:currentVersion.documentationLink,else:'https://docs.typo3.org/typo3cms/extensions/{currentVersion.extensionKey}/')}" target="_blank" rel="noopener noreferrer">
<f:translate key="extensionList.showAllVersions.readOnline" />
</a>
</td>
......
......@@ -35,6 +35,7 @@ CREATE TABLE tx_extensionmanager_domain_model_extension (
integer_version int(11) NOT NULL default '0',
current_version int(3) NOT NULL default '0',
lastreviewedversion int(3) NOT NULL default '0',
documentation_link varchar(2048),
KEY index_extrepo (extension_key,repository),
KEY index_versionrepo (integer_version,repository,extension_key),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment