定制 mwstake/mediawiki-component-commonuserinterface 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mwstake/mediawiki-component-commonuserinterface

最新稳定版本:6.0.1

Composer 安装命令:

composer require mwstake/mediawiki-component-commonuserinterface

包简介

Provides common user interface elements and customizeable stylings

README 文档

README

CommonUserInterface for MediaWiki

Provides common user interface elements and customizeable stylings.

This code is meant to be executed within the MediaWiki application context. No standalone usage is intended.

Compatibility

  • 6.0.x -> MediaWiki 1.43
  • 5.0.x -> MediaWiki 1.39
  • 3.0.x -> MediaWiki 1.35

Use in a MediaWiki extension

Require this component in the composer.json of your extension:

{
	"require": {
		"mwstake/mediawiki-component-commonuserinterface": "~6"
	}
}

Since 3.0 explicit initialization is required. This can be achived by

  • either adding "callback": "mwsInitComponents" to your extension.json/skin.json
  • or calling mwsInitComponents(); within you extensions/skins custom callback method

See also mwstake/mediawiki-componentloader.

Components and Renderers

Default renderer types:

  • *
  • bootstrap-5

A skin may define

$GLOBALS['mwsgCommonUIComponentRendererType'] = 'bootstrap-5';

if it provides "Twitter Bootstrap V5". The "CommonUserInterface" will fall back to * of the requested renderer is not available to the chosen type.

Custom renderers

$GLOBALS['mwsgCommonUIComponentRendererRegistry']['my-custom-renderer']['button'] = '...';

Skin Slots

Default slots:

  • siteNoticeAfter: Uses hook SiteNoticeAfter to add components to any default skin
  • dataAfterContent: Uses hook SkinAfterContent to add components to any default skin

Examples:

$GLOBALS['mwsgCommonUISkinSlots']['siteNoticeAfter']['my-sitenoticeafter-toolbar'] = [
	'factory' => function() {
		return new MWStake\MediaWiki\Component\CommonUserInterface\Component\SimpleToolbar( [
			'items' => [
				new MWStake\MediaWiki\Component\CommonUserInterface\Component\SimpleDropDown( [
					'label' => new RawMessage( 'Click me!' ),
					'toggleRLModules' => [ 'my-dropdown-module' ]
				] )
			]
		] );
	}
];

$GLOBALS['mwsgCommonUISkinSlots']['skinAfterContent']['my-skinaftercontent-panel'] = [
	'factory' => function() {
		return new MWStake\MediaWiki\Component\CommonUserInterface\Component\SimplePanel( [
			'title' => new RawMessage( 'My panel' ),
			'collapsible' => true,
			'collapsed' => true,
			'expandRLModules' => [ 'my-panel-module' ]
		] );
	}
];

TODO

Client side rendering

Example:

mws.commonui.renderPath( '<skinslot>/<parentComponentId>/<subComponentId>', $container );

统计信息

  • 总下载量: 34.4k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 6
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-only
  • 更新时间: 2020-05-11