Merge "Update docs/hooks.txt for ShowSearchHitTitle"
[mediawiki.git] / resources / src / mediawiki / htmlform / htmlform.Element.js
blob4f672fc7864f9882ebd16d550fbc4f6ea1a16fd2
1 ( function ( mw ) {
3         mw.htmlform = {};
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          * @param {Object} [config] Configuration options
14          */
15         mw.htmlform.Element = function ( config ) {
16                 // Configuration initialization
17                 config = config || {};
19                 // Properties
20                 this.hideIf = config.hideIf;
22                 // Initialization
23                 if ( this.hideIf ) {
24                         this.$element.addClass( 'mw-htmlform-hide-if' );
25                 }
26         };
28         mw.htmlform.FieldLayout = function ( config ) {
29                 // Parent constructor
30                 mw.htmlform.FieldLayout.parent.call( this, config );
31                 // Mixin constructors
32                 mw.htmlform.Element.call( this, config );
33         };
34         OO.inheritClass( mw.htmlform.FieldLayout, OO.ui.FieldLayout );
35         OO.mixinClass( mw.htmlform.FieldLayout, mw.htmlform.Element );
37         mw.htmlform.ActionFieldLayout = function ( config ) {
38                 // Parent constructor
39                 mw.htmlform.ActionFieldLayout.parent.call( this, config );
40                 // Mixin constructors
41                 mw.htmlform.Element.call( this, config );
42         };
43         OO.inheritClass( mw.htmlform.ActionFieldLayout, OO.ui.ActionFieldLayout );
44         OO.mixinClass( mw.htmlform.ActionFieldLayout, mw.htmlform.Element );
46 }( mediaWiki ) );