You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Field/ChoiceField.php
+12-2Lines changed: 12 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -126,8 +126,8 @@ public function renderAsBadges($badgeSelector = true): self
126
126
127
127
if (\is_array($badgeSelector)) {
128
128
foreach ($badgeSelectoras$badgeType) {
129
-
if (!\in_array($badgeType, self::VALID_BADGE_TYPES, true)) {
130
-
thrownew \InvalidArgumentException(sprintf('The values of the array passed to the "%s" method must be one of the following valid badge types: "%s" ("%s" given).', __METHOD__, implode(', ', self::VALID_BADGE_TYPES), $badgeType));
129
+
if (!self::isSupportedBadge($badgeType)) {
130
+
thrownew \InvalidArgumentException(sprintf('The values of the array passed to the "%s" method must be a full 6-digit hexadecimal color or one of the following valid badge types: "%s" ("%s" given).', __METHOD__, implode(', ', self::VALID_BADGE_TYPES), $badgeType));
131
131
}
132
132
}
133
133
}
@@ -137,6 +137,16 @@ public function renderAsBadges($badgeSelector = true): self
if (!\in_array($badgeType, ChoiceField::VALID_BADGE_TYPES, true)) {
187
-
thrownew \RuntimeException(sprintf('The value returned by the callable passed to the "renderAsBadges()" method must be one of the following valid badge types: "%s" ("%s" given).', implode(', ', ChoiceField::VALID_BADGE_TYPES), $badgeType));
193
+
if (!ChoiceField::isSupportedBadge($badgeType)) {
194
+
thrownew \RuntimeException(sprintf('The value returned by the callable passed to the "renderAsBadges()" method must be a full 6-digit hexadecimal color or one of the following valid badge types: "%s" ("%s" given).', implode(', ', ChoiceField::VALID_BADGE_TYPES), $badgeType));
0 commit comments