Skip to content

Commit

Permalink
Using the same condition for share button
Browse files Browse the repository at this point in the history
(cherry picked from commit db45cbb)
  • Loading branch information
lens0021 committed Jun 11, 2021
1 parent b60136f commit e6d6390
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions includes/SkinFemiwiki.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct( $options = [] ) {
if ( $this->getUser()->isLoggedIn() ) {
$options['scripts'][] = 'skins.femiwiki.notifications';
}
if ( !$this->getTitle()->isSpecialPage() ) {
if ( $this->shouldShowShare() ) {
$options['scripts'][] = 'skins.femiwiki.share';
}
parent::__construct( $options );
Expand Down Expand Up @@ -89,11 +89,18 @@ protected function getSidebar() {
return [ $sidebar, $toolbox ];
}

/**
* @return bool
*/
protected function shouldShowShare() {
return $this->getOutput()->getTitle()->getArticleID() !== 0;
}

/**
* @return string|null
*/
protected function getShare() {
if ( $this->getOutput()->getTitle()->getArticleID() === 0 ) {
if ( !$this->shouldShowShare() ) {
return null;
}
return new ButtonWidget( [
Expand Down

0 comments on commit e6d6390

Please sign in to comment.