44 * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2015 - 2023
55 * @package yii2-widgets
66 * @subpackage yii2-widget-activeform
7- * @version 1.6.3
7+ * @version 1.6.4
88 */
99
1010namespace kartik \form ;
@@ -1156,7 +1156,7 @@ protected function getToggleField($type = self::TYPE_CHECKBOX, $options = [], $e
11561156 */
11571157 protected function parseFormFlag ($ flag , &$ options )
11581158 {
1159- if (!property_exists ($ this ->form , $ flag )) {
1159+ if (!property_exists ($ this ->form , $ flag ) || isset ( $ options [ $ flag ]) ) {
11601160 return ;
11611161 }
11621162 $ action = $ this ->form ->$ flag ;
@@ -1783,8 +1783,8 @@ protected function getToggleFieldList($type, $items, $options = [], $asBtnGrp =
17831783 $ inputType = "{$ type }List " ;
17841784 $ opts = ArrayHelper::getValue ($ options , 'itemOptions ' , []);
17851785 $ this ->initDisability ($ opts );
1786- $ css = $ this -> form -> disabled ? ' disabled ' : '' ;
1787- $ css .= $ this -> form -> readonly ? ' readonly ' : '' ;
1786+ $ css = ! empty ( $ opts [ ' disabled ' ]) ? ' disabled ' : '' ;
1787+ $ css .= ! empty ( $ opts [ ' readonly ' ]) ? ' readonly ' : '' ;
17881788 if ($ notBs3 ) {
17891789 Html::addCssClass ($ this ->labelOptions , 'pt-0 ' );
17901790 }
@@ -1812,9 +1812,7 @@ protected function getToggleFieldList($type, $items, $options = [], $asBtnGrp =
18121812 Lib::strtolower (Lib::preg_replace ('/[^a-zA-Z0-9=\s—–-]+/u ' , '- ' , $ name )).'- ' .$ index ;
18131813 $ opts += [
18141814 'data-index ' => $ index ,
1815- 'value ' => $ value ,
1816- 'disabled ' => $ this ->form ->disabled ,
1817- 'readonly ' => $ this ->form ->readonly ,
1815+ 'value ' => $ value
18181816 ];
18191817 $ enclosedLabel = (!$ cust && !$ notBs3 ) || ($ asBtnGrp && !$ isBs5 );
18201818 if ($ enclosedLabel ) {
@@ -1840,13 +1838,11 @@ protected function getToggleFieldList($type, $items, $options = [], $asBtnGrp =
18401838 }
18411839 $ opts ['autocomplete ' ] = 'off ' ;
18421840 }
1843- if (!empty ($ disabled ) && in_array ($ value , $ disabled ) || $ this -> form -> disabled ) {
1841+ if (!empty ($ disabled ) && in_array ($ value , $ disabled ) || ! empty ( $ opts [ ' disabled ' ]) ) {
18441842 Html::addCssClass ($ labelOpts , 'disabled ' );
1845- $ opts ['disabled ' ] = true ;
18461843 }
1847- if (!empty ($ readonly ) && in_array ($ value , $ readonly ) || $ this ->form ->readonly ) {
1848- Html::addCssClass ($ labelOpts , 'disabled ' );
1849- $ opts ['readonly ' ] = true ;
1844+ if (!empty ($ readonly ) && in_array ($ value , $ readonly ) || !empty ($ opts ['readonly ' ])) {
1845+ Html::addCssClass ($ labelOpts , 'readonly ' );
18501846 }
18511847 if ($ isBs5 && $ asBtnGrp ) {
18521848 Html::addCssClass ($ opts , 'btn-check ' );
0 commit comments