mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TemplateData
synced 2024-11-28 01:30:00 +00:00
5e50116d6d
InterfaceText now defaults to null instead of {en:""} which was awkward to deal with in the frontend. As specified: - label is InterfaceText - type is a string and must be a one of the recognized types Updated example for the hypothetical variant of Template:Unsigned and removed other no longer needed example. HTML output has been revised per conversation with Trevor, James and Timo: - Not sortable. - Add label to html output. - Aliases in the main parameter column (one per line), but muted in styling. - Add type to html output. The css module styles content from the server, not content generated by javascript. Moved module to position => top to fix flash of unstyled content. Change-Id: I16d3f9e460c5513935b9b55fe4cec0092b38e6c2
51 lines
1.4 KiB
PHP
51 lines
1.4 KiB
PHP
<?php
|
|
/**
|
|
* TemplateInfo extension.
|
|
*
|
|
* @file
|
|
* @ingroup Extensions
|
|
*/
|
|
|
|
if ( version_compare( $wgVersion, '1.20', '<' ) ) {
|
|
echo "Extension:TemplateInfo requires MediaWiki 1.20 or higher.\n";
|
|
exit( 1 );
|
|
}
|
|
|
|
$wgExtensionCredits['parserhook'][] = array(
|
|
'path' => __FILE__,
|
|
'name' => 'TemplateData',
|
|
'author' => array( 'Timo Tijhof' ),
|
|
'version' => '0.1.0',
|
|
'url' => 'https://www.mediawiki.org/wiki/Extension:TemplateData',
|
|
'descriptionmsg' => 'templatedata-desc',
|
|
);
|
|
|
|
/* Setup */
|
|
|
|
$dir = __DIR__;
|
|
|
|
// Register files
|
|
$wgExtensionMessagesFiles['TemplateData'] = $dir . '/TemplateData.i18n.php';
|
|
$wgAutoloadClasses['TemplateDataHooks'] = $dir . '/TemplateData.hooks.php';
|
|
$wgAutoloadClasses['TemplateDataBlob'] = $dir . '/TemplateDataBlob.php';
|
|
$wgAutoloadClasses['ApiTemplateData'] = $dir . '/api/ApiTemplateData.php';
|
|
|
|
// Register hooks
|
|
$wgHooks['ParserFirstCallInit'][] = 'TemplateDataHooks::onParserFirstCallInit';
|
|
$wgHooks['PageContentSave'][] = 'TemplateDataHooks::onPageContentSave';
|
|
$wgHooks['UnitTestsList'][] = 'TemplateDataHooks::onUnitTestsList';
|
|
|
|
// Register APIs
|
|
$wgAPIModules['templatedata'] = 'ApiTemplateData';
|
|
|
|
// Register page properties
|
|
$wgPageProps['templatedata'] = 'Content of <templatedata> tag';
|
|
|
|
// Register modules
|
|
$wgResourceModules['ext.templateData'] = array(
|
|
'styles' => 'resources/ext.templateData.css',
|
|
'position' => 'top',
|
|
'localBasePath' => $dir,
|
|
'remoteExtPath' => 'TemplateData',
|
|
);
|