jenkins-bot has submitted this change and it was merged. Change subject: Use Electron service for printable version ......................................................................
Use Electron service for printable version This is replacing the link behind "printable version" with a link to the PDF rendered by Electron service. This is not yet working together with Collection extension since this extension has another special handling for the "printable version" link. Bug: T146894 Change-Id: Ifbf9bc5af1cc95789fe545f473b8a71d8d5cca32 --- M ElectronPdfService.hooks.php M extension.json 2 files changed, 22 insertions(+), 9 deletions(-) Approvals: Addshore: Looks good to me, approved jenkins-bot: Verified diff --git a/ElectronPdfService.hooks.php b/ElectronPdfService.hooks.php index bd45f34..3ccb442 100644 --- a/ElectronPdfService.hooks.php +++ b/ElectronPdfService.hooks.php @@ -25,15 +25,25 @@ [ 'articletitle' => $title->getPrefixedText() ] ) ]; - } else { - $bar[ 'electronPdfService-sidebar-portlet-heading' ] = [ - [ - 'text' => $skin->msg( 'electronPdfService-sidebar-portlet-print-text' )->escaped(), - 'id' => 'electron-print_pdf', - 'href' => $specialPageTitle->getLocalURL( - [ 'articletitle' => $title->getPrefixedText() ] - ) - ] + } + + return true; + } + + public static function onBuildNavUrls( Skin $skin, &$navUrls ) { + $title = $skin->getTitle(); + if ( is_null( $title ) || !$title->exists() ) { + return false; + } + + $specialPageTitle = SpecialPage::getTitleFor( 'ElectronPdf' ); + + if ( array_key_exists( 'print', $navUrls ) ) { + $navUrls['print'] = [ + 'text' => $skin->msg( 'printableversion' )->text(), + 'href' => $specialPageTitle->getLocalURL( + [ 'articletitle' => $title->getPrefixedText() ] + ) ]; } diff --git a/extension.json b/extension.json index 458bbcd..74a83b9 100644 --- a/extension.json +++ b/extension.json @@ -27,6 +27,9 @@ "Hooks": { "SidebarBeforeOutput": [ "ElectronPdfServiceHooks::onSidebarBeforeOutput" + ], + "SkinTemplateBuildNavUrlsNav_urlsAfterPermalink": [ + "ElectronPdfServiceHooks::onBuildNavUrls" ] }, "MessagesDirs": { -- To view, visit https://gerrit.wikimedia.org/r/313212 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ifbf9bc5af1cc95789fe545f473b8a71d8d5cca32 Gerrit-PatchSet: 8 Gerrit-Project: mediawiki/extensions/ElectronPdfService Gerrit-Branch: master Gerrit-Owner: Tobias Gritschacher <tobias.gritschac...@wikimedia.de> Gerrit-Reviewer: Addshore <addshorew...@gmail.com> Gerrit-Reviewer: Siebrand <siebr...@kitano.nl> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits