From f7cf742c3c4cdb3f643d7d115f144f0209963df5 Mon Sep 17 00:00:00 2001 From: Isarra Date: Fri, 19 Jul 2019 17:17:52 +0000 Subject: [PATCH] Create getContentBlock function to get rid of some of the ridiculous indenting Seriously, what the crap. Break this up a bit, shall we? Also probably means we might be able to extend this better, or something. (Not that I have any idea how that works.) Change-Id: I2576d2244091aabcc973d9d4b7a3020d34f365f8 --- includes/TimelessTemplate.php | 90 ++++++++++++++++++++--------------- 1 file changed, 51 insertions(+), 39 deletions(-) diff --git a/includes/TimelessTemplate.php b/includes/TimelessTemplate.php index cbb086c..76ad84e 100644 --- a/includes/TimelessTemplate.php +++ b/includes/TimelessTemplate.php @@ -37,45 +37,7 @@ class TimelessTemplate extends BaseTemplate { $html .= Html::rawElement( 'div', [ 'id' => 'mw-content-container', 'class' => 'ts-container' ], Html::rawElement( 'div', [ 'id' => 'mw-content-block', 'class' => 'ts-inner' ], Html::rawElement( 'div', [ 'id' => 'mw-content-wrapper' ], - Html::rawElement( 'div', [ 'id' => 'mw-content' ], - Html::rawElement( 'div', [ 'id' => 'content', 'class' => 'mw-body', 'role' => 'main' ], - $this->getSiteNotices() . - $this->getIndicators() . - Html::rawElement( - 'h1', - [ - 'id' => 'firstHeading', - 'class' => 'firstHeading', - 'lang' => $this->get( 'pageLanguage' ) - ], - $this->get( 'title' ) - ) . - Html::rawElement( 'div', [ 'id' => 'siteSub' ], $this->getMsg( 'tagline' )->parse() ) . - Html::rawElement( 'div', [ 'id' => 'mw-page-header-links' ], - $this->getPortlet( - 'namespaces', - $this->pileOfTools['namespaces'], - 'timeless-namespaces' - ) . - $this->getPortlet( - 'more', - $this->pileOfTools['more'], - 'timeless-more' - ) . - $this->getPortlet( - 'views', - $this->pileOfTools['page-primary'], - 'timeless-pagetools' - ) - ) . - $this->getClear() . - Html::rawElement( 'div', [ 'class' => 'mw-body-content', 'id' => 'bodyContent' ], - $this->getContentSub() . - $this->get( 'bodytext' ) . - $this->getClear() - ) - ) - ) . + $this->getContentBlock() . $this->getAfterContent() ) . Html::rawElement( 'div', [ 'id' => 'mw-site-navigation' ], @@ -121,6 +83,56 @@ class TimelessTemplate extends BaseTemplate { echo $html; } + /** + * Generate the page content block + * Broken out here due to the excessive indenting, or stuff. + * + * @return string html + */ + protected function getContentBlock() { + $html = Html::rawElement( + 'div', + [ 'id' => 'content', 'class' => 'mw-body', 'role' => 'main' ], + $this->getSiteNotices() . + $this->getIndicators() . + Html::rawElement( + 'h1', + [ + 'id' => 'firstHeading', + 'class' => 'firstHeading', + 'lang' => $this->get( 'pageLanguage' ) + ], + $this->get( 'title' ) + ) . + Html::rawElement( 'div', [ 'id' => 'siteSub' ], $this->getMsg( 'tagline' )->parse() ) . + Html::rawElement( 'div', [ 'id' => 'mw-page-header-links' ], + $this->getPortlet( + 'namespaces', + $this->pileOfTools['namespaces'], + 'timeless-namespaces' + ) . + $this->getPortlet( + 'more', + $this->pileOfTools['more'], + 'timeless-more' + ) . + $this->getPortlet( + 'views', + $this->pileOfTools['page-primary'], + 'timeless-pagetools' + ) + ) . + $this->getClear() . + Html::rawElement( 'div', [ 'class' => 'mw-body-content', 'id' => 'bodyContent' ], + $this->getContentSub() . + $this->get( 'bodytext' ) . + $this->getClear() + ) + ); + + return Html::rawElement( 'div', [ 'id' => 'mw-content' ], $html ); + } + /** * Generates a block of navigation links with a header *