Skip to content

Commit e3d173d

Browse files
committed
Fixed validation for random shape
Signed-off-by: Jan Henckens <[email protected]>
1 parent fe400e5 commit e3d173d

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

CHANGELOG.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,19 @@
33
All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
6-
## 5.2.0 - 2025-02-14
7-
### Feature
6+
7+
## 5.2.1 - 2025-07-03
8+
### Fixed
9+
- Fixed validation error for random value when working with shapes
10+
11+
## 5.2.0 - 2025-06-23
12+
### Added
813
- Allow filtering for config value fields in the control panel
914

15+
## 5.1.0 - 2025-06-19
16+
### Added
17+
- Added support for single, double and triple color values, and shapes.
18+
1019
## 5.0.2 - 2025-02-14
1120
### Fixed
1221
- Fixed a bug where the field couldn't be saved.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "statikbe/craft-config-values",
33
"description": "Populate a field with values from the plugin's config",
44
"type": "craft-plugin",
5-
"version": "5.2.0",
5+
"version": "5.2.1",
66
"keywords": [
77
"craft",
88
"cms",

src/fields/ConfigValuesFieldField.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
use craft\base\SortableFieldInterface;
1919
use craft\helpers\App;
2020
use statikbe\configvaluesfield\assetbundles\configvalues\ConfigValuesAsset;
21-
use statikbe\configvaluesfield\fields\conditions\ConfigValuesFieldConditionRule;
2221
use statikbe\configvaluesfield\ConfigValuesField;
22+
use statikbe\configvaluesfield\fields\conditions\ConfigValuesFieldConditionRule;
2323

2424
/**
2525
* @author Statik.be
@@ -128,6 +128,9 @@ public function dataShouldMatchType($attribute, $params): void
128128
if (isset($data['shapes']) && isset($data['path'])) {
129129
$path = App::parseEnv($data['path']);
130130
foreach ($data['shapes'] as $filename => $value) {
131+
if (in_array($filename, ['random', ''])) {
132+
continue; // Skip 'random' as it is not a file
133+
}
131134
$filepath = $path . $filename . '.svg';
132135
if (!file_exists($filepath)) {
133136
$this->addError("$attribute", "The file $filename.svg does not exist in the configured path");

src/fields/conditions/ConfigValuesFieldConditionRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace statikbe\configvaluesfield\fields\conditions;
44

5-
use statikbe\configvaluesfield\ConfigValuesField;
65
use craft\base\conditions\BaseMultiSelectConditionRule;
76
use craft\fields\conditions\FieldConditionRuleInterface;
87
use craft\fields\conditions\FieldConditionRuleTrait;
8+
use statikbe\configvaluesfield\ConfigValuesField;
99
use statikbe\configvaluesfield\fields\ConfigValuesFieldField;
1010
use yii\base\InvalidConfigException;
1111

0 commit comments

Comments
 (0)