Jdlrobson has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/335698 )

Change subject: Avoid PHP warnings in desktop Minerva
......................................................................

Avoid PHP warnings in desktop Minerva

Footer version 2 refers to template data that is only available in
the mobile skin. For desktop some special casing is required.

Bug: T153494
Change-Id: I0936674f2898a6f61a9db1712dcc3a1856c5b173
---
M includes/skins/MinervaTemplate.php
1 file changed, 22 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/98/335698/1

diff --git a/includes/skins/MinervaTemplate.php 
b/includes/skins/MinervaTemplate.php
index 5739257..8d3ec87 100644
--- a/includes/skins/MinervaTemplate.php
+++ b/includes/skins/MinervaTemplate.php
@@ -73,33 +73,46 @@
         */
        protected function getFooterTemplateData( $data ) {
                $groups = [];
+               $license = isset( $data['mobile-license'] ) ? 
$data['mobile-license'] : '';
 
                foreach ( $data['footerlinks'] as $category => $links ) {
                        $items = [];
                        foreach ( $links as $link ) {
-                               if ( isset( $this->data[$link] ) && 
$data[$link] !== '' ) {
+                               if ( isset( $this->data[$link] ) && 
$data[$link] ) {
                                        $items[] = [
                                                'category' => $category,
                                                'name' => $link,
                                                'linkhtml' => $data[$link],
                                        ];
+                                       // For desktop Minerva we pull out any 
references to copyright
+                                       if ( $link === 'copyright' ) {
+                                               $license = $data[$link];
+                                       }
                                }
                        }
-                       $groups[] = [
-                               'name' => $category,
-                               'items' => $items,
-                       ];
+
+                       // Exclude the info category to avoid rep
+                       if ( $category !== 'info' ) {
+                               $groups[] = [
+                                       'name' => $category,
+                                       'items' => $items,
+                               ];
+                       }
                }
 
                if ( $this->getSkin()->isFooterV2() ) {
-                       // This turns off the footer id and allows us to 
distinguish the old footer with the new design
-                       return [
+                       $templateData = [
                                'lastmodified' => $this->getHistoryLinkHtml( 
$data ),
-                               'headinghtml' => 
$data['footer-site-heading-html'],
-                               'licensehtml' => $data['mobile-license'],
                                'lists' => $groups,
+                               'licensehtml' => $license,
                                'v1' => false,
                        ];
+                       // site-heading is only set in MobileFrontend for 
mobile skin (not desktop skin)
+                       if ( isset( $data['footer-site-heading-html'] ) ) {
+                               $templateData['headinghtml'] = 
$data['footer-site-heading-html'];
+                       }
+                       // This turns off the footer id and allows us to 
distinguish the old footer with the new design
+                       return $templateData;
                } else {
                        return [
                                'v1' => true,

-- 
To view, visit https://gerrit.wikimedia.org/r/335698
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0936674f2898a6f61a9db1712dcc3a1856c5b173
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <jrob...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to