1
0
mirror of https://github.com/Hutchy68/pivot.git synced 2024-11-21 18:09:03 +01:00

Handles 1.39 deprecations, simplifies skin registration

In 1.36 the skin registration process was modified to support
registration for common skin meta data

This removes warnings in >= 1.39.
This commit is contained in:
Jon Robson 2022-06-10 12:53:18 -07:00
parent 1eb50e8b06
commit f831643f08
2 changed files with 20 additions and 24 deletions

View File

@ -9,8 +9,6 @@
class SkinPivot extends SkinTemplate { class SkinPivot extends SkinTemplate {
public $skinname = 'pivot', $stylename = 'pivot', $template = 'pivotTemplate', $useHeadElement = true;
public function getDefaultModules() { public function getDefaultModules() {
global $wgPivotFeatures; global $wgPivotFeatures;
$wgPivotFeaturesDefaults = array( $wgPivotFeaturesDefaults = array(
@ -37,29 +35,16 @@ class SkinPivot extends SkinTemplate {
if ( $wgPivotFeatures['preloadFontAwesome'] ) { if ( $wgPivotFeatures['preloadFontAwesome'] ) {
$this->getOutput()->addHeadItem('font', '<link rel="preload" href="'.$wgLocalStylePath.'/pivot/assets/fonts/fontawesome-webfont.woff2?v=4.7.0" as="font" type="font/woff2" crossorigin="anonymous" />'); $this->getOutput()->addHeadItem('font', '<link rel="preload" href="'.$wgLocalStylePath.'/pivot/assets/fonts/fontawesome-webfont.woff2?v=4.7.0" as="font" type="font/woff2" crossorigin="anonymous" />');
} }
return parent::getDefaultModules();
$this->getOutput()->addModuleStyles('skins.pivot.styles');
return parent::getDefaultModules();
} }
public function initPage(OutputPage $out) {
global $wgLocalStylePath;
parent::initPage($out);
$viewport_meta = 'width=device-width, user-scalable=yes, initial-scale=1.0';
$out->addMeta('viewport', $viewport_meta);
$out->addModules('skins.pivot.js');
}
} }
class pivotTemplate extends BaseTemplate { class PivotTemplate extends BaseTemplate {
public function execute() { public function execute() {
global $wgUser; global $wgUser;
global $wgPivotFeatures; global $wgPivotFeatures;
Wikimedia\suppressWarnings(); Wikimedia\suppressWarnings();
$this->html('headelement');
switch ($wgPivotFeatures['usePivotTabs']) { switch ($wgPivotFeatures['usePivotTabs']) {
case true: case true:
ob_start(); ob_start();
@ -277,15 +262,10 @@ class pivotTemplate extends BaseTemplate {
<div> <div>
<a class="exit-off-canvas"></a> <a class="exit-off-canvas"></a>
</div> </div>
<?php $this->printTrail(); ?>
<?php if ($this->data['isarticle'] && $wgPivotFeatures['addThisPUBID'] !== '') { ?> <?php if ($this->data['isarticle'] && $wgPivotFeatures['addThisPUBID'] !== '') { ?>
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=<?php echo $wgPivotFeatures['addThisPUBID']; ?>" async="async"></script> <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=<?php echo $wgPivotFeatures['addThisPUBID']; ?>" async="async"></script>
<?php } ?> <?php } ?>
</body>
</html>
<?php <?php
Wikimedia\restoreWarnings(); Wikimedia\restoreWarnings();

View File

@ -10,10 +10,26 @@
"descriptionmsg": "pivot-desc", "descriptionmsg": "pivot-desc",
"type": "skin", "type": "skin",
"ValidSkinNames": { "ValidSkinNames": {
"pivot": "Pivot" "pivot": {
"class": "SkinPivot",
"args": [
{
"name": "pivot",
"template": "PivotTemplate",
"bodyOnly": true,
"responsive": true,
"scripts": [
"skins.pivot.js"
],
"styles": [
"skins.pivot.styles"
]
}
]
}
}, },
"requires": { "requires": {
"MediaWiki": ">= 1.35.0" "MediaWiki": ">= 1.39.0"
}, },
"MessagesDirs": { "MessagesDirs": {
"Skinpivot": [ "Skinpivot": [