SkinAether.php 2.08 KB
Newer Older
Carl Schwan's avatar
Carl Schwan committed
1 2
<?php
/**
Carl Schwan's avatar
Carl Schwan committed
3 4
 * Aether

Carl Schwan's avatar
Carl Schwan committed
5 6 7 8 9
 * @todo document
 * @file
 * @ingroup Skins
 */

Carl Schwan's avatar
Carl Schwan committed
10 11 12 13
require_once __DIR__.'/vendor/autoload.php';
require_once 'JsonManifestNetworkStrategy.php';

use Symfony\Component\Asset\UrlPackage;
Carl Schwan's avatar
Carl Schwan committed
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51

/**
 * SkinTemplate class for Neverland skin
 * @ingroup Skins
 */
class SkinAether extends SkinTemplate {

    public $skinname = 'aether';
    public $stylename = 'Aether';
    public $template = 'AetherTemplate';

    private $neverlandConfig;

    public function __construct() {
        $this->aetherConfig = ConfigFactory::getDefaultInstance()->makeConfig( 'aether' );
    }

    /**
     * Initializes output page and sets up skin-specific parameters
     * @param $out OutputPage object to initialize
     */
    public function initPage( OutputPage $out ) {

        parent::initPage( $out );

        // Append CSS which includes IE only behavior fixes for hover support -
        // this is better than including this in a CSS fille since it doesn't
        // wait for the CSS file to load before fetching the HTC file.
        $min = $this->getRequest()->getFuzzyBool( 'debug' ) ? '' : '.min';
        $out->addModules( array('skins.aether') );
        $out->addMeta( 'viewport', 'width=device-width, initial-scale=1, shrink-to-fit=no' );
    }

    /**
     * Load skin and user CSS files in the correct order
     * @param $out OutputPage object
     */
    function setupSkinUserCss( OutputPage $out ){
Carl Schwan's avatar
Carl Schwan committed
52 53 54 55 56 57 58
        $urlPackage = new UrlPackage(
            'https://cdn.kde.org/',
            new JsonManifestNetworkVersionStrategy('https://cdn.kde.org/aether-devel/version/manifest.json')
        );

        $out->addStyle( $urlPackage->getUrl('aether-devel/version/bootstrap.css'), 'all' );
        $out->addStyle( $urlPackage->getUrl('aether-devel/version/aether-mediawiki.css'), 'all' );
Carl Schwan's avatar
Carl Schwan committed
59
        $out->addStyle( $urlPackage->getUrl('aether-devel/version/aether-sidebar.css'), 'all' );
Carl Schwan's avatar
Carl Schwan committed
60 61 62 63 64 65 66 67 68
    }

    /**
     * Override to pass our Config instance to it
     */
    public function setupTemplate( $classname, $repository = false, $cache_dir = false ) {
        return new $classname( $this->aetherConfig );
    }
}