Skip to content

Commit fbe5898

Browse files
haszihaszi
and
haszi
authored
Move contribution links to the bottom of the documentation pages (#973)
Co-authored-by: haszi <haszika80@gmail.com>
1 parent fef2ba3 commit fbe5898

File tree

2 files changed

+37
-23
lines changed

2 files changed

+37
-23
lines changed

include/shared-manual.inc

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -323,30 +323,13 @@ function manual_setup($setup): void {
323323
];
324324
site_header($setup["this"][1] . " - Manual ", $config);
325325

326-
$id = substr($setup['this'][0], 0, -4);
327-
$repo = strtolower($config['lang']); // pt_BR etc.
328-
329-
$edit_url = "https://github.com/php/doc-{$repo}";
330-
// If the documentation source information is available (generated using
331-
// doc-base/configure.php and PhD) then try and make a source-specific URL.
332-
if (isset($setup['source'])) {
333-
$source_lang = $setup['source']['lang'];
334-
if ($source_lang === $repo || $source_lang === 'base') {
335-
$edit_url = "https://github.com/php/doc-{$source_lang}/blob/master/{$setup['source']['path']}";
336-
}
337-
}
338-
339326
$languageChooser = manual_language_chooser($config['lang'], $config['thispage']);
340327

341328
echo <<<PAGE_TOOLS
342329
<div class="page-tools">
343330
<div class="change-language">
344331
{$languageChooser}
345332
</div>
346-
<div class="edit-bug">
347-
<a href="{$edit_url}">Submit a Pull Request</a>
348-
<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>
349-
</div>
350333
</div>
351334
PAGE_TOOLS;
352335
}
@@ -381,9 +364,35 @@ CHANGE_LANG;
381364
return trim($r);
382365
}
383366

384-
function manual_footer(): void {
367+
function manual_footer($setup): void {
385368
global $USERNOTES, $__RELATED;
386369

370+
$id = substr($setup['this'][0], 0, -4);
371+
$repo = strtolower($setup["head"][1]); // pt_BR etc.
372+
373+
$edit_url = "https://github.com/php/doc-{$repo}";
374+
// If the documentation source information is available (generated using
375+
// doc-base/configure.php and PhD) then try and make a source-specific URL.
376+
if (isset($setup['source'])) {
377+
$source_lang = $setup['source']['lang'];
378+
if ($source_lang === $repo || $source_lang === 'base') {
379+
$edit_url = "https://github.com/php/doc-{$source_lang}/blob/master/{$setup['source']['path']}";
380+
}
381+
}
382+
383+
echo <<<CONTRIBUTE
384+
<div class="contribute">
385+
<h3 class="title">Improve This Page</h3>
386+
<div class="edit-bug">
387+
<a href="https://github.com/php/doc-base/blob/master/README.md" title="This will take you to our contribution guidelines on GitHub." target="_blank" rel="noopener noreferrer">Learn how improve this page</a>
388+
389+
<a href="{$edit_url}">Submit a Pull Request</a>
390+
391+
<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>
392+
</div>
393+
</div>
394+
CONTRIBUTE;
395+
387396
manual_notes($USERNOTES);
388397
site_footer([
389398
'related_menu' => $__RELATED['toc'],

styles/theme-base.css

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -419,14 +419,19 @@ hr {
419419
.page-tools {
420420
text-align: right;
421421
}
422-
423-
.page-tools #changelang-langs,
424-
.page-tools .edit-bug {
422+
.page-tools #changelang-langs {
425423
font-size:.75rem;
426424
}
427-
.page-tools .edit-bug a {
425+
426+
.contribute {
427+
border: 1px solid #888;
428+
border-radius: 3px;
429+
margin: 0px -10px 0px -10px;
430+
padding: 0 10px 5px 10px;
431+
background-color: #E2E2E2;
432+
}
433+
.contribute .edit-bug a {
428434
border: 0;
429-
margin-left: 1rem;
430435
}
431436

432437
/**

0 commit comments

Comments
 (0)