Allow extensions to add extra meta item checkboxes to the page settings dialog

Like this:

ve.ui.MWSettingsPage.static.addMetaCheckbox(
    'metaItemName', // e.g. 'mwDisambiguation'
    'checkboxLabel' // e.g. 'Disambiguation page'
);

Depending on 'ext.visualEditor.mwmeta'

Bug: 61073
Change-Id: I78dd68ff5aad20c7e66c4ce1528b6f1bbc74892d
This commit is contained in:
Krenair 2014-04-29 13:43:14 +01:00 committed by Alex Monk
parent 35c0694279
commit 12d14b9e26

View file

@ -100,7 +100,7 @@ ve.ui.MWSettingsPage = function VeUiMWSettingsPage( name, config ) {
metaName: 'mwNoEditSection',
label: ve.msg( 'visualeditor-dialog-meta-settings-noeditsection-label' )
}
];
].concat( ve.ui.MWSettingsPage.static.extraMetaCheckboxes );
/*global mw*/
if ( mw.config.get( 'wgNamespaceNumber' ) === mw.config.get( 'wgNamespaceIds' ).category ) {
this.metaItemCheckboxes.push(
@ -141,6 +141,18 @@ ve.ui.MWSettingsPage = function VeUiMWSettingsPage( name, config ) {
OO.inheritClass( ve.ui.MWSettingsPage, OO.ui.PageLayout );
/* Allow extra meta item checkboxes to be added by extensions etc. */
ve.ui.MWSettingsPage.static.extraMetaCheckboxes = [];
/**
* Add a checkbox to the list of changeable page settings
* @param {string} metaName The name of the DM meta item
* @param {string} label The label to show next to the checkbox
*/
ve.ui.MWSettingsPage.static.addMetaCheckbox = function ( metaName, label ) {
this.extraMetaCheckboxes.push( { 'metaName': metaName, 'label': label } );
};
/* Methods */
/* Table of Contents methods */