Merge pull request #65 from StarCitizenTools/dev

Fixed missing footer components
This commit is contained in:
alistair3149 2020-01-07 13:38:12 -05:00 committed by GitHub
commit 631cc473ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -779,6 +779,7 @@ class CitizenTemplate extends BaseTemplate {
* * 'link-prefix' to set the prefix for all link and block ids; most skins use 'f' or 'footer', * * 'link-prefix' to set the prefix for all link and block ids; most skins use 'f' or 'footer',
* as in id='f-whatever' vs id='footer-whatever' * as in id='f-whatever' vs id='footer-whatever'
* * 'icon-style' to pass to getFooterIcons: "icononly", "nocopyright" * * 'icon-style' to pass to getFooterIcons: "icononly", "nocopyright"
* * 'link-style' to pass to getFooterLinks: "flat" to disable categorisation of links in a
* nested array * nested array
* *
* @return string html * @return string html
@ -790,28 +791,24 @@ class CitizenTemplate extends BaseTemplate {
'order' => 'linksfirst', 'order' => 'linksfirst',
'link-prefix' => 'footer', 'link-prefix' => 'footer',
'icon-style' => 'icononly', 'icon-style' => 'icononly',
'link-style' => 'flat',
]; ];
$validFooterIcons = $this->getFooterIcons( $options['icon-style'] ); $validFooterIcons = $this->getFooterIcons( $options['icon-style'] );
$validFooterLinks = $this->getFooterLinks(); $validFooterLinks = $this->getFooterLinks( $options['link-style'] );
$html = ''; $html = '';
$html .= Html::openElement( 'footer', [ $html .= Html::openElement( 'footer', [
'id' => $options['id'], 'id' => $options['id'],
'role' => 'contentinfo', 'role' => 'contentinfo',
'lang' => $this->get( 'userlang' ), 'lang' => $this->get( 'userlang' ),
'dir' => $this->get( 'dir' ), 'dir' => $this->get( 'dir' ),
] ); ] );
$iconsHTML = ''; $iconsHTML = '';
if ( count( $validFooterIcons ) > 0 ) { if ( count( $validFooterIcons ) > 0 ) {
$iconsHTML .= Html::openElement( 'div', $iconsHTML .= Html::openElement( 'div',
[ 'id' => "{$options['link-prefix']}-container-icons" ] ); [ 'id' => "{$options['link-prefix']}-container-icons" ] );
$iconsHTML .= Html::openElement( 'div', [ 'id' => 'footer-bottom-container' ] ); $iconsHTML .= Html::openElement( 'div', [ 'id' => 'footer-bottom-container' ] );
// Get tagline // Get tagline
$iconsHTML .= $this->getFooterTagline(); $iconsHTML .= $this->getFooterTagline();
$iconsHTML .= Html::openElement( 'ul', [ 'id' => "{$options['link-prefix']}-icons" ] ); $iconsHTML .= Html::openElement( 'ul', [ 'id' => "{$options['link-prefix']}-icons" ] );
foreach ( $validFooterIcons as $blockName => $footerIcons ) { foreach ( $validFooterIcons as $blockName => $footerIcons ) {
$iconsHTML .= Html::openElement( 'li', [ $iconsHTML .= Html::openElement( 'li', [
@ -827,37 +824,55 @@ class CitizenTemplate extends BaseTemplate {
$iconsHTML .= Html::closeElement( 'div' ); $iconsHTML .= Html::closeElement( 'div' );
$iconsHTML .= Html::closeElement( 'div' ); $iconsHTML .= Html::closeElement( 'div' );
} }
$linksHTML = ''; $linksHTML = '';
if ( count( $validFooterLinks ) > 0 ) { if ( count( $validFooterLinks ) > 0 ) {
$linksHTML .= Html::openElement( 'div', $linksHTML .= Html::openElement( 'div',
[ 'id' => "{$options['link-prefix']}-container-list" ] ); [ 'id' => "{$options['link-prefix']}-container-list" ] );
if ( $options['link-style'] === 'flat' ) {
$linksHTML .= Html::openElement( 'ul', [ $linksHTML .= Html::openElement( 'ul', [
'id' => "{$options['link-prefix']}-list", 'id' => "{$options['link-prefix']}-list",
'class' => 'footer-places', 'class' => 'footer-places',
] ); ] );
// Site title // Site title
$linksHTML .= Html::rawElement( 'li', [ 'id' => 'sitetitle' ], $linksHTML .= Html::rawElement( 'li', [ 'id' => 'sitetitle' ],
$this->getSiteTitle( 'text' ) ); $this->getSiteTitle( 'text' ) );
// Site description // Site description
$linksHTML .= Html::rawElement( 'li', [ 'id' => 'sitedesc' ], $linksHTML .= Html::rawElement( 'li', [ 'id' => 'sitedesc' ],
$this->getFooterDesc() ); $this->getFooterDesc() );
foreach ( $validFooterLinks as $link ) { foreach ( $validFooterLinks as $link ) {
$linksHTML .= Html::rawElement( 'li', $linksHTML .= Html::rawElement( 'li',
[ 'id' => Sanitizer::escapeIdForAttribute( $link ) ], $this->get( $link ) ); [ 'id' => Sanitizer::escapeIdForAttribute( $link ) ], $this->get( $link ) );
} }
$linksHTML .= Html::closeElement( 'ul' ); $linksHTML .= Html::closeElement( 'ul' );
} else {
$linksHTML .= Html::openElement( 'div',
[ 'id' => "{$options['link-prefix']}-list" ] );
foreach ( $validFooterLinks as $category => $links ) {
$linksHTML .= Html::openElement( 'ul', [
'id' => Sanitizer::escapeIdForAttribute( "{$options['link-prefix']}-{$category}" ),
] );
foreach ( $links as $link ) {
$linksHTML .= Html::rawElement( 'li', [
'id' => Sanitizer::escapeIdForAttribute( "{$options['link-prefix']}-{$category}-{$link}" ),
], $this->get( $link ) );
}
$linksHTML .= Html::closeElement( 'ul' );
}
// Site title
$linksHTML .= Html::rawElement( 'li', [ 'id' => 'footer-sitetitle' ],
$this->getSiteTitle( 'text' ) );
// Site logo
$linksHTML .= Html::rawElement( 'li', [ 'id' => 'footer-sitelogo' ],
$this->getLogo() );
$linksHTML .= Html::closeElement( 'div' );
}
$linksHTML .= Html::closeElement( 'div' ); $linksHTML .= Html::closeElement( 'div' );
} }
if ( $options['order'] === 'iconsfirst' ) { if ( $options['order'] === 'iconsfirst' ) {
$html .= $iconsHTML . $linksHTML; $html .= $iconsHTML . $linksHTML;
} else { } else {
$html .= $linksHTML . $iconsHTML; $html .= $linksHTML . $iconsHTML;
} }
return $html . $this->getClear() . Html::closeElement( 'footer' ); return $html . $this->getClear() . Html::closeElement( 'footer' );
} }
} }