Skip to content

Commit

Permalink
including options on function field
Browse files Browse the repository at this point in the history
  • Loading branch information
dklbueno committed Aug 17, 2023
1 parent b87c457 commit 63ca5f2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Fields/FunctionField.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,20 @@ public function getFunctionParams()
{
return $this->functionParams;
}

public function options($value, $parsed = false)
{
if ($parsed) {
return $this->addParameter('options', $value);
}

$options = [];
foreach ($value as $key => $label) {
array_push($options, [
'label' => $label,
'value' => $key
]);
}
return $this->addParameter('options', $options);
}
}

0 comments on commit 63ca5f2

Please sign in to comment.