aboutsummaryrefslogtreecommitdiffstats
path: root/includes/api/ApiFormatBase.php
diff options
context:
space:
mode:
authorKeerthanaS <keerukeerthana8@gmail.com>2016-01-26 02:55:57 +0530
committerFederico Leva <federicoleva@tiscali.it>2017-06-14 13:35:09 +0200
commite1d6c40efec3653617cdd5a3ed91e293858196dd (patch)
tree9d02a113838a5f679ce3aa55b384329fbf807329 /includes/api/ApiFormatBase.php
parenta3f66f4966c3c2be6e795d689f99bad5d16c8135 (diff)
downloadmediawikicore-e1d6c40efec3653617cdd5a3ed91e293858196dd.tar.gz
mediawikicore-e1d6c40efec3653617cdd5a3ed91e293858196dd.zip
Linked HTML representation of a format to formatted output
Added Hyperlink to non-HTML formatted output from the HTML representation of the output Bug: T123905 Change-Id: Id55c524a29f679b8e06d4e3d05bd50e8685fb830
Diffstat (limited to 'includes/api/ApiFormatBase.php')
-rw-r--r--includes/api/ApiFormatBase.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/includes/api/ApiFormatBase.php b/includes/api/ApiFormatBase.php
index eb23bd63ace7..36247dd981ac 100644
--- a/includes/api/ApiFormatBase.php
+++ b/includes/api/ApiFormatBase.php
@@ -219,7 +219,14 @@ abstract class ApiFormatBase extends ApiBase {
if ( !$this->getIsWrappedHtml() ) {
// When the format without suffix 'fm' is defined, there is a non-html version
if ( $this->getMain()->getModuleManager()->isDefined( $lcformat, 'format' ) ) {
- $msg = $context->msg( 'api-format-prettyprint-header' )->params( $format, $lcformat );
+ if ( !$this->getRequest()->wasPosted() ) {
+ $nonHtmlUrl = strtok( $this->getRequest()->getFullRequestURL(), '?' )
+ . '?' . $this->getRequest()->appendQueryValue( 'format', $lcformat );
+ $msg = $context->msg( 'api-format-prettyprint-header-hyperlinked' )
+ ->params( $format, $lcformat, $nonHtmlUrl );
+ } else {
+ $msg = $context->msg( 'api-format-prettyprint-header' )->params( $format, $lcformat );
+ }
} else {
$msg = $context->msg( 'api-format-prettyprint-header-only-html' )->params( $format );
}