Skip to content

Commit

Permalink
Money, too
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Oct 9, 2024
1 parent 145422b commit a7c2720
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/fields/conditions/MoneyFieldConditionRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,8 @@ protected function inputHtml(): string
*/
protected function inputOptions(): array
{
/** @var Money $field */
$field = $this->field();
if (!$field instanceof Money) {
throw new InvalidConfigException();
}
$defaultValue = null;
if ($field->defaultValue !== null) {
$defaultValue = MoneyHelper::toNumber(new MoneyLibrary($field->defaultValue, new Currency($field->currency)));
Expand Down Expand Up @@ -136,6 +134,10 @@ protected function inputOptions(): array
*/
protected function elementQueryParam(): ?string
{
if (!$this->field() instanceof Money) {
return null;
}

return $this->paramValue();
}

Expand All @@ -145,8 +147,7 @@ protected function elementQueryParam(): ?string
protected function matchFieldValue($value): bool
{
if (!$this->field() instanceof Money) {
// No longer a Money field
return false;
return true;
}

/** @var int|float|null $value */
Expand Down

0 comments on commit a7c2720

Please sign in to comment.