Skip to content

Commit

Permalink
add select
Browse files Browse the repository at this point in the history
  • Loading branch information
nadar committed Aug 9, 2023
1 parent 3356b59 commit 09deb09
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
In order to read more about upgrading and BC breaks have a look at the [UPGRADE Document](UPGRADE.md).

## 1.7.4 (9. August 2023)

+ Add empty attribute name check to SelectBlock.

## 1.7.3 (9. August 2023)

+ Enhance the handling of empty attribute name values to ensure that the input is hidden gracefully instead of triggering an error when no attribute name is provided. Additionally, empty arrays for select and checkbox inputs no longer result in exceptions. Instead, an empty array is now the default, ensuring that nothing is displayed and the process proceeds smoothly.
Expand Down
7 changes: 6 additions & 1 deletion src/blocks/SelectBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,12 @@ public function frontend()
$this->getVarValue($this->varFormatAs)
);

$activeField = Yii::$app->forms->form->field(Yii::$app->forms->model, $this->getVarValue($this->varAttribute));
$varName = $this->getVarValue($this->varAttribute);
if (!$varName) {
return;
}

$activeField = Yii::$app->forms->form->field(Yii::$app->forms->model, $this->getVarValue($varName));

$values = ArrayHelper::combine(ArrayHelper::getColumn($this->getVarValue('values', []), 'value'));

Expand Down

0 comments on commit 09deb09

Please sign in to comment.