From 61e32e135d69cf7ed8a6b390e532dd64390b3150 Mon Sep 17 00:00:00 2001 From: Samuel Georges Date: Tue, 8 Oct 2024 17:13:35 +1100 Subject: [PATCH] Comments --- src/Element/OptionDefinition.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Element/OptionDefinition.php b/src/Element/OptionDefinition.php index c5604a0ce..adecd6e9e 100644 --- a/src/Element/OptionDefinition.php +++ b/src/Element/OptionDefinition.php @@ -40,15 +40,17 @@ protected function initDefaultValues() /** * useOptionConfig */ - public function useOptionConfig($value, $option = null): OptionDefinition + public function useOptionConfig($value, $option): OptionDefinition { $this->value($value)->label($value); + // Option as string if (!is_array($option)) { $this->label($option); return $this; } + // Option as definition if (Arr::isAssoc($option)) { if (isset($option['children']) && is_array($option['children'])) { $option['children'] = $this->evalChildOptions($option['children']); @@ -58,6 +60,7 @@ public function useOptionConfig($value, $option = null): OptionDefinition return $this; } + // Option as [label, comment] $firstPart = (string) ($option[0] ?? ''); $secondPart = (string) ($option[1] ?? '');