37474f6833eb9055925ffdd771207e89c50c5615
[lhc/web/wiklou.git] / resources / src / mediawiki / htmlform / htmlform.Element.js
1 ( function ( mw ) {
2
3 mw.htmlform = {};
4
5 /**
6 * Allows custom data specific to HTMLFormField to be set for OOjs UI forms. This picks up the
7 * extra config from a matching PHP widget (defined in HTMLFormElement.php) when constructed using
8 * OO.ui.infuse().
9 *
10 * Currently only supports passing 'hide-if' data.
11 *
12 * @ignore
13 */
14 mw.htmlform.Element = function ( config ) {
15 // Configuration initialization
16 config = config || {};
17
18 // Properties
19 this.hideIf = config.hideIf;
20
21 // Initialization
22 if ( this.hideIf ) {
23 this.$element.addClass( 'mw-htmlform-hide-if' );
24 }
25 };
26
27 mw.htmlform.FieldLayout = function ( config ) {
28 // Parent constructor
29 mw.htmlform.FieldLayout.parent.call( this, config );
30 // Mixin constructors
31 mw.htmlform.Element.call( this, config );
32 };
33 OO.inheritClass( mw.htmlform.FieldLayout, OO.ui.FieldLayout );
34 OO.mixinClass( mw.htmlform.FieldLayout, mw.htmlform.Element );
35
36 mw.htmlform.ActionFieldLayout = function ( config ) {
37 // Parent constructor
38 mw.htmlform.ActionFieldLayout.parent.call( this, config );
39 // Mixin constructors
40 mw.htmlform.Element.call( this, config );
41 };
42 OO.inheritClass( mw.htmlform.ActionFieldLayout, OO.ui.ActionFieldLayout );
43 OO.mixinClass( mw.htmlform.ActionFieldLayout, mw.htmlform.Element );
44
45 }( mediaWiki ) );