mwstake / mediawiki-component-commonuserinterface
Provides common user interface elements and customizeable stylings
Installs: 22 345
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 9
Forks: 1
Open Issues: 1
Requires
- composer/installers: ~1.0|~2
- mwstake/mediawiki-componentloader: ~1
Requires (Dev)
- mediawiki/mediawiki-codesniffer: 39.0.0
- mediawiki/minus-x: 1.1.1
- php-parallel-lint/php-console-highlighter: 1.0.0
- php-parallel-lint/php-parallel-lint: 1.3.2
- phpunit/phpunit: ^8.5
- dev-master
- 5.0.1
- 5.0.0
- 4.0.x-dev
- 4.0.2
- 4.0.1
- 4.0.0
- 3.2.x-dev
- 3.2.6
- 3.2.5
- 3.2.4
- 3.2.3
- 3.2.2
- 3.2.1
- 3.2.0
- 3.1.x-dev
- 3.1.2
- 3.1.1
- 3.1.0
- 3.0.x-dev
- 3.0.9
- 3.0.8
- 3.0.7
- 3.0.6
- 3.0.5
- 3.0.4
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- 2.0.x-dev
- 2.0.7
- 2.0.6
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.x-dev
- 1.1
- 1.0
- dev-ERM31389
- dev-ERM38444
- dev-wcag
- dev-CS
- dev-LinklistGroupText
- dev-ERM27470
- dev-OOJSUITheme
This package is auto-updated.
Last update: 2024-10-04 04:46:43 UTC
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.
Use in a MediaWiki extension
Add "mwstake/mediawiki-component-commonuserinterface": "~3.0"
to the require
section of your composer.json
file.
Since 3.0 explicit initialization is required. This can be achived by
- either adding
"callback": "mwsInitComponents"
to yourextension.json
/skin.json
- or calling
mwsInitComponents();
within you extensions/skins customcallback
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 hookSiteNoticeAfter
to add components to any default skindataAfterContent
: Uses hookSkinAfterContent
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 );