Merge "Move Other Projects block to interwiki chunk"

isekai
jenkins-bot 6 years ago committed by Gerrit Code Review
commit b60faa7953

@ -9,13 +9,26 @@ class TimelessTemplate extends BaseTemplate {
/** @var array */ /** @var array */
protected $pileOfTools; protected $pileOfTools;
/** @var array */
protected $sidebar;
/** @var array|null */
protected $otherProjects;
/** /**
* Outputs the entire contents of the page * Outputs the entire contents of the page
*/ */
public function execute() { public function execute() {
$this->sidebar = $this->getSidebar();
$this->pileOfTools = $this->getPageTools(); $this->pileOfTools = $this->getPageTools();
$userLinks = $this->getUserLinks(); $userLinks = $this->getUserLinks();
// WikiBase sidebar thing
if ( isset( $this->sidebar['wikibase-otherprojects'] ) ) {
$this->otherProjects = $this->sidebar['wikibase-otherprojects'];
unset( $this->sidebar['wikibase-otherprojects'] );
}
// Open html, body elements, etc // Open html, body elements, etc
$html = $this->get( 'headelement' ); $html = $this->get( 'headelement' );
@ -400,17 +413,16 @@ class TimelessTemplate extends BaseTemplate {
* @return string html * @return string html
*/ */
protected function getMainNavigation() { protected function getMainNavigation() {
$sidebar = $this->getSidebar();
$html = ''; $html = '';
// Already hardcoded into header // Already hardcoded into header
$sidebar['SEARCH'] = false; $this->sidebar['SEARCH'] = false;
// Parsed as part of pageTools // Parsed as part of pageTools
$sidebar['TOOLBOX'] = false; $this->sidebar['TOOLBOX'] = false;
// Forcibly removed to separate chunk // Forcibly removed to separate chunk
$sidebar['LANGUAGES'] = false; $this->sidebar['LANGUAGES'] = false;
foreach ( $sidebar as $name => $content ) { foreach ( $this->sidebar as $name => $content ) {
if ( $content === false ) { if ( $content === false ) {
continue; continue;
} }
@ -844,22 +856,35 @@ class TimelessTemplate extends BaseTemplate {
*/ */
protected function getInterlanguageLinks() { protected function getInterlanguageLinks() {
$html = ''; $html = '';
$show = false;
$variants = '';
$projects = '';
$languages = '';
if ( isset( $this->data['variant_urls'] ) && $this->data['variant_urls'] !== false ) { if ( isset( $this->data['variant_urls'] ) && $this->data['variant_urls'] !== false ) {
$variants = $this->getPortlet( 'variants', $this->data['variant_urls'], true ); $variants = $this->getPortlet( 'variants', $this->data['variant_urls'], true );
} else { $show = true;
$variants = ''; }
// Wikibase thing
if ( isset( $this->otherProjects ) ) {
$projects = $this->getPortlet( 'wikibase-otherprojects', $this->otherProjects['content'] );
$show = true;
} }
if ( $this->data['language_urls'] !== false ) { if ( $this->data['language_urls'] !== false ) {
$languages = $this->getPortlet(
'lang',
$this->data['language_urls'] ?: [],
'otherlanguages'
);
$show = true;
}
if ( $show ) {
$html .= $this->getSidebarChunk( $html .= $this->getSidebarChunk(
'other-languages', 'other-languages',
'timeless-languages', 'timeless-languages',
$variants . $variants . $languages . $projects
$this->getPortlet(
'lang',
$this->data['language_urls'] ?: [],
'otherlanguages'
)
); );
} }

Loading…
Cancel
Save