Commit 835c66d7 authored by Andreas Fernandez's avatar Andreas Fernandez Committed by Thomas Löffler

[WIP][TASK] Migrate documentation link generation to new structure of manuals.json

WARNING: Preparation patch - merge after go-live!

This change updates the link generation to documentations. With new
documentation server in place, the manuals.json contains more information,
for example the link to the rendered documentation per extension version.
parent 465b57f8
......@@ -58,7 +58,7 @@ class UpdateCurrentVersionListTask extends \TYPO3\CMS\Extbase\Scheduler\Task
{
$result = false;
$targetFile = PATH_site . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'] . 'currentdocumentationdata.json';
$sourceData = GeneralUtility::getUrl('https://docs.typo3.org/typo3cms/extensions/manuals.json');
$sourceData = GeneralUtility::getUrl('https://intercept.typo3.com/assets/docs/manuals.json');
if (json_decode($sourceData, true) !== null) {
$result = GeneralUtility::writeFile($targetFile, $sourceData);
}
......
......@@ -21,12 +21,6 @@ namespace T3o\TerFe2\Service;
*/
class DocumentationService implements \TYPO3\CMS\Core\SingletonInterface
{
/**
* @var string
*/
protected $baseUrl = '';
/**
* @var array
*/
......@@ -42,7 +36,6 @@ class DocumentationService implements \TYPO3\CMS\Core\SingletonInterface
*/
public function __construct()
{
$this->baseUrl = 'https://docs.typo3.org/typo3cms/extensions/';
$this->availableFormats = [
'sxw',
'html',
......@@ -68,13 +61,13 @@ class DocumentationService implements \TYPO3\CMS\Core\SingletonInterface
throw new \Exception('Extension key and version string are required to build a documentation url');
}
$manualExists = isset($this->docsInformation->$extensionKey);
$manualExists = isset($this->docsInformation->{$extensionKey}['docs'][$versionString]);
$documentationLink = null;
$url = null;
if ($manualExists) {
// link to extension to get the latest manual
$url = $this->baseUrl . $extensionKey . '/';
$url = $this->docsInformation->{$extensionKey}['docs'][$versionString]['url'];
// check if link is not broken
// need to remove the 200 response check due to change in header for docs.typo3.org
$documentationLink = '<a href="' . $url . '">Extension Manual</a>';
......
Markdown is supported
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