-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [TASK] Update integration test baseline Whitespace handling changed in the guides, therefore our integration tests need to be updated for whitespace. * [TASK] Make globals linkable
- Loading branch information
Showing
5 changed files
with
95 additions
and
1 deletion.
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
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
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,50 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace T3Docs\GuidesPhpDomain\TextRoles; | ||
|
||
use phpDocumentor\Guides\Nodes\Inline\ReferenceNode; | ||
use phpDocumentor\Guides\ReferenceResolvers\AnchorNormalizer; | ||
use phpDocumentor\Guides\RestructuredText\Parser\DocumentParserContext; | ||
use Psr\Log\LoggerInterface; | ||
|
||
final class GlobalTextRole extends PhpComponentTextRole | ||
{ | ||
private const TYPE = 'global'; | ||
|
||
public function __construct( | ||
LoggerInterface $logger, | ||
private readonly AnchorNormalizer $anchorNormalizer, | ||
) { | ||
parent::__construct($logger, $anchorNormalizer); | ||
} | ||
|
||
protected function createNode(DocumentParserContext $documentParserContext, string $referenceTarget, string|null $referenceName, string $role): ReferenceNode | ||
{ | ||
if (preg_match(self::INTERLINK_NAME_REGEX, $referenceTarget, $matches)) { | ||
return $this->createNodeWithInterlink($matches[2], $matches[1], $referenceName); | ||
} | ||
return $this->createNodeWithInterlink($referenceTarget, '', $referenceName); | ||
} | ||
|
||
private function createNodeWithInterlink(string $referenceTarget, string $interlinkDomain, string|null $referenceName): ReferenceNode | ||
{ | ||
$id = $this->anchorNormalizer->reduceAnchor($referenceTarget); | ||
|
||
return new ReferenceNode($id, $referenceName ?? $referenceTarget, $interlinkDomain, 'php:' . $this->getName()); | ||
} | ||
|
||
public function getName(): string | ||
{ | ||
return self::TYPE; | ||
} | ||
|
||
/** | ||
* @return list<string> | ||
*/ | ||
public function getAliases(): array | ||
{ | ||
return []; | ||
} | ||
} |
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 @@ | ||
<!-- content start --> | ||
<div class="section" id="php-global-variable"> | ||
<h1>PHP Global Variable</h1> | ||
<dl class="php global"> | ||
<dt class="sig sig-object php" | ||
id="globals-tca"> | ||
<em class="property"><span class="pre">global</span> </em> | ||
<span class="pre">$GLOBALS['TCA']</span> | ||
<a class="headerlink" href="#globals-tca" title="Permalink to this definition">¶</a> </dt> | ||
<dd> | ||
|
||
<p>Contains the TYPO3 Configuration Array</p> | ||
|
||
</dd> | ||
</dl> | ||
|
||
<p>See also <a href="/index.html#globals-tca">$GLOBALS['TCA']</a>.</p> | ||
|
||
</div> | ||
<!-- content end --> |
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,9 @@ | ||
=================== | ||
PHP Global Variable | ||
=================== | ||
|
||
.. php:global:: $GLOBALS['TCA'] | ||
Contains the TYPO3 Configuration Array | ||
|
||
See also :php:global:`$GLOBALS['TCA']`. |