Skip to content

Commit

Permalink
Revert "no h3 for portlet name null"
Browse files Browse the repository at this point in the history
This reverts commit dc2c650.
  • Loading branch information
TranTheTrung committed May 26, 2021
1 parent dbd8073 commit 3476fb5
Showing 1 changed file with 22 additions and 38 deletions.
60 changes: 22 additions & 38 deletions skins/Timeless/includes/TimelessTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,25 +189,21 @@ protected function getPortlet( $name, $content, $msg = null, $setOptions = [] )
], $setOptions );

// Handle the different $msg possibilities
if ( $name == '' ) {
$msgString = '';
else {
if ( $msg === null ) {
$msg = $name;
$msgParams = [];
} elseif ( is_array( $msg ) ) {
$msgString = array_shift( $msg );
$msgParams = $msg;
$msg = $msgString;
} else {
$msgParams = [];
}
$msgObj = $this->getMsg( $msg, $msgParams );
if ( $msgObj->exists() ) {
$msgString = $msgObj->parse();
} else {
$msgString = htmlspecialchars( $msg );
}
if ( $msg === null ) {
$msg = $name;
$msgParams = [];
} elseif ( is_array( $msg ) ) {
$msgString = array_shift( $msg );
$msgParams = $msg;
$msg = $msgString;
} else {
$msgParams = [];
}
$msgObj = $this->getMsg( $msg, $msgParams );
if ( $msgObj->exists() ) {
$msgString = $msgObj->parse();
} else {
$msgString = htmlspecialchars( $msg );
}

$labelId = Sanitizer::escapeIdForAttribute( "p-$name-label" );
Expand Down Expand Up @@ -256,22 +252,13 @@ protected function getPortlet( $name, $content, $msg = null, $setOptions = [] )
$bodyDivOptions['id'] = $options['body-id'];
}

if ($name == '') {
$html = Html::rawElement( 'div', $divOptions,
Html::rawElement( 'div', $bodyDivOptions,
$contentText .
$this->getAfterPortlet( $name )
)
);
} else {
$html = Html::rawElement( 'div', $divOptions,
Html::rawElement( 'h3', $labelOptions, $msgString ) .
Html::rawElement( 'div', $bodyDivOptions,
$contentText .
$this->getAfterPortlet( $name )
)
);
}
$html = Html::rawElement( 'div', $divOptions,
Html::rawElement( 'h3', $labelOptions, $msgString ) .
Html::rawElement( 'div', $bodyDivOptions,
$contentText .
$this->getAfterPortlet( $name )
)
);

return $html;
}
Expand Down Expand Up @@ -342,9 +329,6 @@ protected function getMainNavigation() {
}
// Numeric strings gets an integer when set as key, cast back - T73639
$name = (string)$name;
if ( $name == 'navigation' ) {
$name = '';
}
if ( $name == 'TOOLBOX' ) {
$html .= $this->getUserLinks();
$html .= $this->getPortlet( 'actions', $this->pileOfTools['page-primary']);
Expand Down

0 comments on commit 3476fb5

Please sign in to comment.