wiki.techinc.nl/includes/skins/SkinApi.php
jdlrobson 26d5f78f84 skins: Port SkinFallback and SkinApiOutput to a generic SkinMustache class
The new SkinMustache class is based on the emerging class in Vector.
Having this in core, will allow Vector to make use of this class
immediately and provide a minimal generic mechanism going forward
for rendering skins using Mustache. For now, I've fleshed out the minimum
possible data in getTemplateData which are based on existing functions in
Vector.

The Skin class now takes a generic options parameter which allows
registration of a skin using the SkinMustache class with a templateDirectory
option pointing to the associated template. A `styles` option can be passed
to define stylesheets that should be associated with the skin.

The SkinApi and SkinFallback classes are reduced significantly.

There are no known uses of SkinApiTemplate and it is thus removed.

SkinFallbackTemplate is removed and its functions copied across to
SkinFallback

End user changes:
* The fallback skin no longer prints the confusing warning message if the default
  skin is setup incorrectly. Previously viewing the fallback skin with useskin
  indicated that wgDefaultSkin was not set correctly which was misleading and confusing.
* Factory functions now receive skin options as a second parameter and the service as a
  first - this is due to how ObjectFactory handles the extraArgs key for 'factory' key
  - placing it at the beginning.

Bug: T254048
Change-Id: Ibbabd1d0f26efebf8f8ff068966685dc2191c527
2020-06-15 10:51:31 -07:00

38 lines
1.3 KiB
PHP

<?php
/**
* Extremely basic "skin" for API output, which needs to output a page without
* the usual skin elements but still using CSS, JS, and such via OutputPage and
* ResourceLoader.
*
* Copyright © 2014 Wikimedia Foundation and contributors
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
*/
/**
* SkinTemplate class for API output
* @since 1.25
*/
class SkinApi extends SkinMustache {
public $skinname = 'apioutput';
/**
* Extension of class methods is discouraged.
* Developers are encouraged to improve the flexibility of SkinMustache
* whereever possible.
*/
}