skins: Clarify SkinTemplate and QuickTemplate class doc comments
Bug: T263213 Change-Id: I7fa8349764ec31b47aac853ed1a5f45c40c3b1cf
This commit is contained in:
parent
1e781731bc
commit
6dc93ec72a
3 changed files with 41 additions and 15 deletions
|
|
@ -22,9 +22,11 @@ use Wikimedia\WrappedString;
|
|||
use Wikimedia\WrappedStringList;
|
||||
|
||||
/**
|
||||
* New base template for a skin's template extended from QuickTemplate
|
||||
* this class features helper methods that provide common ways of interacting
|
||||
* with the data stored in the QuickTemplate
|
||||
* Extended QuickTemplate with additional MediaWiki-specific helper methods.
|
||||
*
|
||||
* @todo Phase this class out and make it an alias for QuickTemplate. Move methods
|
||||
* individually as-appropriate either down to QuickTemplate, or (with deprecation)
|
||||
* up to SkinTemplate.
|
||||
*
|
||||
* @stable to extend
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -22,8 +22,38 @@ use MediaWiki\HookContainer\ProtectedHookAccessorTrait;
|
|||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* Generic wrapper for template functions, with interface
|
||||
* compatible with what we use of PHPTAL 0.7.
|
||||
* PHP-based skin template that holds data.
|
||||
*
|
||||
* Modern usage with returned output:
|
||||
*
|
||||
* class MyTemplate extends QuickTemplate {
|
||||
* public function execute() {
|
||||
* $html = 'Hello, ' . Html::element( 'strong', [], $this->get( 'name' ) );
|
||||
* echo $html;
|
||||
* }
|
||||
* }
|
||||
* $tpl = new MyTemplate();
|
||||
* $tpl->set( 'name', 'World' );
|
||||
* $output = $tpl->getHTML();
|
||||
*
|
||||
* Classic usage with native HTML echo:
|
||||
*
|
||||
* class MyTemplate extends QuickTemplate {
|
||||
* public function execute() { ?>
|
||||
*
|
||||
* Hello, <strong><?php $this->text( 'name' ); ?></strong>
|
||||
*
|
||||
* <?php
|
||||
* }
|
||||
* }
|
||||
* $tpl = new MyTemplate();
|
||||
* $tpl->set( 'name', 'World' );
|
||||
*
|
||||
* $tpl->execute(); // echo output
|
||||
*
|
||||
*
|
||||
* QuickTemplate was originally developed as drop-in replacement for PHPTAL 0.7 (<http://phptal.org/>).
|
||||
*
|
||||
* @stable to extend
|
||||
* @ingroup Skins
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
/**
|
||||
* Copyright © Gabriel Wicke -- http://www.aulinx.de/
|
||||
*
|
||||
* 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
|
||||
|
|
@ -22,19 +24,11 @@ use MediaWiki\MediaWikiServices;
|
|||
use MediaWiki\Permissions\Authority;
|
||||
|
||||
/**
|
||||
* Base class for template-based skins.
|
||||
* Base class for QuickTemplate-based skins.
|
||||
*
|
||||
* Template-filler skin base class
|
||||
* Formerly generic PHPTal (http://phptal.sourceforge.net/) skin
|
||||
* Based on Brion's smarty skin
|
||||
* @copyright Copyright © Gabriel Wicke -- http://www.aulinx.de/
|
||||
*
|
||||
* @todo Needs some serious refactoring into functions that correspond
|
||||
* to the computations individual esi snippets need. Most importantly no body
|
||||
* parsing for most of those of course.
|
||||
* The template data is filled in SkinTemplate::prepareQuickTemplate.
|
||||
*
|
||||
* @stable to extend
|
||||
*
|
||||
* @ingroup Skins
|
||||
*/
|
||||
class SkinTemplate extends Skin {
|
||||
|
|
|
|||
Loading…
Reference in a new issue