Move SkinTemplate::getFooterIcons() to Skin class
- Changing access modifier from protected to public in order to call this method from the SkinComponentFooter class which is introduced in a follow up commit. Bug: T302116 Change-Id: If06112d72ef19001ca5673cf0329fca071384ffe
This commit is contained in:
parent
ca0c1dbc8d
commit
e0224b8f4b
2 changed files with 45 additions and 44 deletions
|
|
@ -963,6 +963,51 @@ abstract class Skin extends ContextSource {
|
|||
return "<a href='{$url}'><img{$a} src='{$logourl}' alt='[{$mp}]' /></a>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get template representation of the footer.
|
||||
* @since 1.35
|
||||
* @stable to override
|
||||
* @return array
|
||||
*/
|
||||
public function getFooterIcons() {
|
||||
$config = $this->getConfig();
|
||||
|
||||
$footericons = [];
|
||||
foreach (
|
||||
$config->get( MainConfigNames::FooterIcons ) as $footerIconsKey => &$footerIconsBlock
|
||||
) {
|
||||
if ( count( $footerIconsBlock ) > 0 ) {
|
||||
$footericons[$footerIconsKey] = [];
|
||||
foreach ( $footerIconsBlock as &$footerIcon ) {
|
||||
if ( isset( $footerIcon['src'] ) ) {
|
||||
if ( !isset( $footerIcon['width'] ) ) {
|
||||
$footerIcon['width'] = 88;
|
||||
}
|
||||
if ( !isset( $footerIcon['height'] ) ) {
|
||||
$footerIcon['height'] = 31;
|
||||
}
|
||||
}
|
||||
|
||||
// Only output icons which have an image.
|
||||
// For historic reasons this mimics the `icononly` option
|
||||
// for BaseTemplate::getFooterIcons.
|
||||
// In some cases the icon may be an empty array.
|
||||
// Filter these out. (See T269776)
|
||||
if ( is_string( $footerIcon ) || isset( $footerIcon['src'] ) ) {
|
||||
$footericons[$footerIconsKey][] = $footerIcon;
|
||||
}
|
||||
}
|
||||
|
||||
// If no valid icons with images were added, unset the parent array
|
||||
// Should also prevent empty arrays from when no copyright is set.
|
||||
if ( !count( $footericons[$footerIconsKey] ) ) {
|
||||
unset( $footericons[$footerIconsKey] );
|
||||
}
|
||||
}
|
||||
}
|
||||
return $footericons;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a $wgFooterIcons icon according to the method's arguments
|
||||
* @param array $icon The icon to build the html for, see $wgFooterIcons
|
||||
|
|
|
|||
|
|
@ -177,50 +177,6 @@ class SkinTemplate extends Skin {
|
|||
echo $this->generateHTML();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get template representation of the footer.
|
||||
* @since 1.35
|
||||
* @return array
|
||||
*/
|
||||
protected function getFooterIcons() {
|
||||
$config = $this->getConfig();
|
||||
|
||||
$footericons = [];
|
||||
foreach (
|
||||
$config->get( MainConfigNames::FooterIcons ) as $footerIconsKey => &$footerIconsBlock
|
||||
) {
|
||||
if ( count( $footerIconsBlock ) > 0 ) {
|
||||
$footericons[$footerIconsKey] = [];
|
||||
foreach ( $footerIconsBlock as &$footerIcon ) {
|
||||
if ( isset( $footerIcon['src'] ) ) {
|
||||
if ( !isset( $footerIcon['width'] ) ) {
|
||||
$footerIcon['width'] = 88;
|
||||
}
|
||||
if ( !isset( $footerIcon['height'] ) ) {
|
||||
$footerIcon['height'] = 31;
|
||||
}
|
||||
}
|
||||
|
||||
// Only output icons which have an image.
|
||||
// For historic reasons this mimics the `icononly` option
|
||||
// for BaseTemplate::getFooterIcons.
|
||||
// In some cases the icon may be an empty array.
|
||||
// Filter these out. (See T269776)
|
||||
if ( is_string( $footerIcon ) || isset( $footerIcon['src'] ) ) {
|
||||
$footericons[$footerIconsKey][] = $footerIcon;
|
||||
}
|
||||
}
|
||||
|
||||
// If no valid icons with images were added, unset the parent array
|
||||
// Should also prevent empty arrays from when no copyright is set.
|
||||
if ( !count( $footericons[$footerIconsKey] ) ) {
|
||||
unset( $footericons[$footerIconsKey] );
|
||||
}
|
||||
}
|
||||
}
|
||||
return $footericons;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue