Anomie has submitted this change and it was merged.
Change subject: Add getPersonalToolsList to SkinTemplate
......................................................................
Add getPersonalToolsList to SkinTemplate
This is for CentralAuth, so it can replace the p-personal list.
Bug: 50619
Change-Id: I7385bcb36e45310fb08da05f8df8925acd7d9890
(cherry picked from commit e02715b58a51a25579993e9a178adc63f404d5e7)
---
M includes/SkinTemplate.php
1 file changed, 56 insertions(+), 26 deletions(-)
Approvals:
Anomie: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php
index 18f410a..5a6114b 100644
--- a/includes/SkinTemplate.php
+++ b/includes/SkinTemplate.php
@@ -165,6 +165,47 @@
return $language_urls;
}
+ protected function setupTemplateForOutput() {
+ wfProfileIn( __METHOD__ );
+
+ $request = $this->getRequest();
+ $user = $this->getUser();
+ $title = $this->getTitle();
+
+ wfProfileIn( __METHOD__ . '-init' );
+ $tpl = $this->setupTemplate( $this->template, 'skins' );
+ wfProfileOut( __METHOD__ . '-init' );
+
+ wfProfileIn( __METHOD__ . '-stuff' );
+ $this->thispage = $title->getPrefixedDBkey();
+ $this->titletxt = $title->getPrefixedText();
+ $this->userpage = $user->getUserPage()->getPrefixedText();
+ $query = array();
+ if ( !$request->wasPosted() ) {
+ $query = $request->getValues();
+ unset( $query['title'] );
+ unset( $query['returnto'] );
+ unset( $query['returntoquery'] );
+ }
+ $this->thisquery = wfArrayToCgi( $query );
+ $this->loggedin = $user->isLoggedIn();
+ $this->username = $user->getName();
+
+ if ( $this->loggedin || $this->showIPinHeader() ) {
+ $this->userpageUrlDetails = self::makeUrlDetails(
$this->userpage );
+ } else {
+ # This won't be used in the standard skins, but we
define it to preserve the interface
+ # To save time, we check for existence
+ $this->userpageUrlDetails = self::makeKnownUrlDetails(
$this->userpage );
+ }
+
+ wfProfileOut( __METHOD__ . '-stuff' );
+
+ wfProfileOut( __METHOD__ );
+
+ return $tpl;
+ }
+
/**
* initialize various variables and generate the template
*
@@ -197,34 +238,9 @@
wfProfileIn( __METHOD__ . '-init' );
$this->initPage( $out );
-
- $tpl = $this->setupTemplate( $this->template, 'skins' );
wfProfileOut( __METHOD__ . '-init' );
- wfProfileIn( __METHOD__ . '-stuff' );
- $this->thispage = $title->getPrefixedDBkey();
- $this->titletxt = $title->getPrefixedText();
- $this->userpage = $user->getUserPage()->getPrefixedText();
- $query = array();
- if ( !$request->wasPosted() ) {
- $query = $request->getValues();
- unset( $query['title'] );
- unset( $query['returnto'] );
- unset( $query['returntoquery'] );
- }
- $this->thisquery = wfArrayToCgi( $query );
- $this->loggedin = $user->isLoggedIn();
- $this->username = $user->getName();
-
- if ( $this->loggedin || $this->showIPinHeader() ) {
- $this->userpageUrlDetails = self::makeUrlDetails(
$this->userpage );
- } else {
- # This won't be used in the standard skins, but we
define it to preserve the interface
- # To save time, we check for existence
- $this->userpageUrlDetails = self::makeKnownUrlDetails(
$this->userpage );
- }
-
- wfProfileOut( __METHOD__ . '-stuff' );
+ $tpl = $this->setupTemplateForOutput();
wfProfileIn( __METHOD__ . '-stuff-head' );
if ( !$this->useHeadElement ) {
@@ -516,6 +532,20 @@
}
/**
+ * Get the HTML for the p-personal list
+ * @return string
+ */
+ public function getPersonalToolsList() {
+ $tpl = $this->setupTemplateForOutput();
+ $tpl->set( 'personal_urls', $this->buildPersonalUrls() );
+ $html = '';
+ foreach ( $tpl->getPersonalTools() as $key => $item ) {
+ $html .= $tpl->makeListItem( $key, $item );
+ }
+ return $html;
+ }
+
+ /**
* Format language name for use in sidebar interlanguage links list.
* By default it is capitalized.
*
--
To view, visit https://gerrit.wikimedia.org/r/72537
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7385bcb36e45310fb08da05f8df8925acd7d9890
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.22wmf9
Gerrit-Owner: CSteipp <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits