From: Sam Wilson Date: Tue, 19 Sep 2017 07:46:25 +0000 (+0800) Subject: Add classes to HTMLCheckMatrix items to identify forced ones X-Git-Tag: 1.31.0-rc.0~2018^2 X-Git-Url: http://git.cyclocoop.org//%22javascript:ModifierStyle%28%27%22.%24id.%22%27%29/%22?a=commitdiff_plain;h=feb5be31fddb154cdc659650647d05070bc58bdc;p=lhc%2Fweb%2Fwiklou.git Add classes to HTMLCheckMatrix items to identify forced ones Some items in an HTMLCheckMatrix form field can be forced to be on or off, in which case they're disabled. This adds three new class names, so that (for example) Javascript can identify these checkboxes. There are not currently any classes assigned to them. Bug: T172585 Change-Id: I984020ce2437effb3ff5f186470105fd80d4a00f --- diff --git a/includes/htmlform/fields/HTMLCheckMatrix.php b/includes/htmlform/fields/HTMLCheckMatrix.php index fa18a3cdad..dd4e707ee5 100644 --- a/includes/htmlform/fields/HTMLCheckMatrix.php +++ b/includes/htmlform/fields/HTMLCheckMatrix.php @@ -121,9 +121,11 @@ class HTMLCheckMatrix extends HTMLFormField implements HTMLNestedFilterable { if ( $this->isTagForcedOff( $thisTag ) ) { $checked = false; $thisAttribs['disabled'] = 1; + $thisAttribs['class'] = 'checkmatrix-forced checkmatrix-forced-off'; } elseif ( $this->isTagForcedOn( $thisTag ) ) { $checked = true; $thisAttribs['disabled'] = 1; + $thisAttribs['class'] = 'checkmatrix-forced checkmatrix-forced-on'; } $checkbox = $this->getOneCheckbox( $checked, $attribs + $thisAttribs );