Skip to content

Commit

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

// Handle the different $msg possibilities
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 ( $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 );
}
}

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

$html = Html::rawElement( 'div', $divOptions,
Html::rawElement( 'h3', $labelOptions, $msgString ) .
Html::rawElement( 'div', $bodyDivOptions,
$contentText .
$this->getAfterPortlet( $name )
)
);
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 )
)
);
}

return $html;
}
Expand Down Expand Up @@ -329,6 +342,9 @@ 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 dc2c650

Please sign in to comment.