Merge "Add two hooks to allow for extensions to expose log_search values in the UI"
[lhc/web/wiklou.git] / includes / htmlform / HTMLCheckMatrix.php
index 2fc170c..6c538fd 100644 (file)
@@ -75,9 +75,9 @@ class HTMLCheckMatrix extends HTMLFormField implements HTMLNestedFilterable {
         * mParams['rows'] is an array with row labels as keys and row tags as values.
         * mParams['columns'] is an array with column labels as keys and column tags as values.
         *
-        * @param array $value of the options that should be checked
+        * @param array $value Array of the options that should be checked
         *
-        * @return String
+        * @return string
         */
        function getInputHTML( $value ) {
                $html = '';
@@ -113,8 +113,9 @@ class HTMLCheckMatrix extends HTMLFormField implements HTMLNestedFilterable {
                        foreach ( $columns as $columnTag ) {
                                $thisTag = "$columnTag-$rowTag";
                                // Construct the checkbox
+                               $thisId = "{$this->mID}-$thisTag";
                                $thisAttribs = array(
-                                       'id' => "{$this->mID}-$thisTag",
+                                       'id' => $thisId,
                                        'value' => $thisTag,
                                );
                                $checked = in_array( $thisTag, (array)$value, true );
@@ -125,10 +126,17 @@ class HTMLCheckMatrix extends HTMLFormField implements HTMLNestedFilterable {
                                        $checked = true;
                                        $thisAttribs['disabled'] = 1;
                                }
+                               $chkBox = Xml::check( "{$this->mName}[]", $checked, $attribs + $thisAttribs );
+                               if ( $this->mParent->getConfig()->get( 'UseMediaWikiUIEverywhere' ) ) {
+                                       $chkBox = Html::openElement( 'div', array( 'class' => 'mw-ui-checkbox' ) ) .
+                                               $chkBox .
+                                               Html::element( 'label', array( 'for' => $thisId ) ) .
+                                               Html::closeElement( 'div' );
+                               }
                                $rowContents .= Html::rawElement(
                                        'td',
                                        array(),
-                                       Xml::check( "{$this->mName}[]", $checked, $attribs + $thisAttribs )
+                                       $chkBox
                                );
                        }
                        $tableContents .= Html::rawElement( 'tr', array(), "\n$rowContents\n" );
@@ -159,9 +167,9 @@ class HTMLCheckMatrix extends HTMLFormField implements HTMLNestedFilterable {
         * line above the options in the case of a checkbox matrix, i.e. it's always
         * a "vertical-label".
         *
-        * @param string $value the value to set the input to
+        * @param string $value The value to set the input to
         *
-        * @return String complete HTML table row
+        * @return string Complete HTML table row
         */
        function getTableRow( $value ) {
                list( $errors, $errorClass ) = $this->getErrorsAndErrorClass( $value );
@@ -187,9 +195,9 @@ class HTMLCheckMatrix extends HTMLFormField implements HTMLNestedFilterable {
        }
 
        /**
-        * @param $request WebRequest
+        * @param WebRequest $request
         *
-        * @return Array
+        * @return array
         */
        function loadDataFromRequest( $request ) {
                if ( $this->mParent->getMethod() == 'post' ) {