Skip to content

Commit b30936d

Browse files
committed
Updates to release v2.2.1 fixes #334 fixes #332
1 parent 05ed365 commit b30936d

24 files changed

+38
-49
lines changed

CHANGE.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ Change Log: `yii2-widget-select2`
33

44
## Version 2.2.1
55

6-
**Date:** _under development_
6+
**Date:** 09-Jun-2021
77

8+
- (enh #334): Correct multiple select placeholder styles.
9+
- (enh #332): Enhance Select2 required attribute validation when used with model.
810
- Fix Krajee BS themes styling for multiple select.
911

1012
## Version 2.2.0

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2014 - 2020, Kartik Visweswaran
1+
Copyright (c) 2014 - 2021, Kartik Visweswaran
22
Krajee.com
33
All rights reserved.
44

src/Select2.php

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2020
4+
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2021
55
* @package yii2-widgets
66
* @subpackage yii2-widget-select2
77
* @version 2.2.1
@@ -128,7 +128,8 @@ class Select2 extends InputWidget
128128
* - `unselectLabel`: _string_, the markup to be shown to unselect all records. Defaults to:
129129
* `<i class="glyphicon glyphicon-checked"></i> Unselect all`.
130130
* - `selectOptions`: _array_, the HTML attributes for the container wrapping the select label. Defaults to `[]`.
131-
* - `unselectOptions`: _array_, the HTML attributes for the container wrapping the unselect label. Defaults to `[]`.
131+
* - `unselectOptions`: _array_, the HTML attributes for the container wrapping the unselect label. Defaults to
132+
* `[]`.
132133
* - `options`: _array_, the HTML attributes for the toggle button container. Defaults to:
133134
* `['class' => 's2-togall-button']`.
134135
*/
@@ -458,15 +459,9 @@ protected function isRequired()
458459
}
459460
$validators = $this->model->getActiveValidators($this->attribute);
460461
foreach ($validators as $validator) {
461-
if ($validator instanceof RequiredValidator) {
462-
if (is_callable($validator->when)) {
463-
if (call_user_func($validator->when, $this->model, $this->attribute)) {
464-
return true;
465-
}
466-
} else {
467-
return true;
468-
}
469-
462+
if ($validator instanceof RequiredValidator && (!is_callable($validator->when) ||
463+
call_user_func($validator->when, $this->model, $this->attribute))) {
464+
return true;
470465
}
471466
}
472467
return false;

src/Select2Asset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2020
4+
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2021
55
* @package yii2-widgets
66
* @subpackage yii2-widget-select2
77
* @version 2.2.1

src/Select2KrajeeAsset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2020
4+
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2021
55
* @package yii2-widgets
66
* @subpackage yii2-widget-select2
77
* @version 2.2.1

src/ThemeAsset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2020
4+
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2021
55
* @package yii2-widgets
66
* @subpackage yii2-widget-select2
77
* @version 2.2.1

src/ThemeBootstrapAsset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2020
4+
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2021
55
* @package yii2-widgets
66
* @subpackage yii2-widget-select2
77
* @version 2.2.1

src/ThemeClassicAsset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2020
4+
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2021
55
* @package yii2-widgets
66
* @subpackage yii2-widget-select2
77
* @version 2.2.1

src/ThemeDefaultAsset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2020
4+
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2021
55
* @package yii2-widgets
66
* @subpackage yii2-widget-select2
77
* @version 2.2.1

src/ThemeKrajeeAsset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2020
4+
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2021
55
* @package yii2-widgets
66
* @subpackage yii2-widget-select2
77
* @version 2.2.1

0 commit comments

Comments
 (0)