Skip to content

Commit 491af6f

Browse files
authored
link to documentation source file when possible (#434)
Also direct readers to the language-specific repository to report issues.
1 parent 7bf6acd commit 491af6f

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

include/shared-manual.inc

+13-2
Original file line numberDiff line numberDiff line change
@@ -442,14 +442,25 @@ function manual_setup($setup) {
442442
$id = substr($setup['this'][0], 0, -4);
443443
$language_chooser = 'manual_language_chooser';
444444
$repo = strtolower($config['lang']); // pt_BR etc.
445+
446+
$edit_url = "https://github.com/php/doc-{$repo}";
447+
// If the documentation source information is available (generated using
448+
// doc-base/configure.php and PhD) then try and make a source-specific URL.
449+
if (isset($setup['source'])) {
450+
$source_lang = $setup['source']['lang'];
451+
if ($source_lang === $repo || $source_lang === 'base') {
452+
$edit_url = "https://github.com/php/doc-{$source_lang}/blob/master/{$setup['source']['path']}";
453+
}
454+
}
455+
445456
echo <<<PAGE_TOOLS
446457
<div class="page-tools">
447458
<div class="change-language">
448459
{$language_chooser($config['lang'], $config['thispage'])}
449460
</div>
450461
<div class="edit-bug">
451-
<a href="https://github.com/php/doc-{$repo}">Submit a Pull Request</a>
452-
<a href="https://github.com/php/doc-en/issues/new?body=From%20manual%20page:%20https:%2F%2Fphp.net%2F$id%0A%0A---">Report a Bug</a>
462+
<a href="{$edit_url}">Submit a Pull Request</a>
463+
<a href="https://github.com/php/doc-{$repo}/issues/new?body=From%20manual%20page:%20https:%2F%2Fphp.net%2F$id%0A%0A---">Report a Bug</a>
453464
</div>
454465
</div>
455466
PAGE_TOOLS;

0 commit comments

Comments
 (0)