From c6064bd25973fe2f97023015bd651f187d3e0f19 Mon Sep 17 00:00:00 2001 From: Richard Henkenjohann Date: Mon, 10 Apr 2023 02:03:04 +0200 Subject: [PATCH] Add Select::id() --- src/Entities/Properties/Select.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/Entities/Properties/Select.php b/src/Entities/Properties/Select.php index d950c1b..831b772 100644 --- a/src/Entities/Properties/Select.php +++ b/src/Entities/Properties/Select.php @@ -17,6 +17,28 @@ class Select extends Property implements Modifiable */ private Collection $options; + + /** + * @param $id + * @return Select + */ + public static function id(string $id): Select + { + $selectProperty = new Select(); + + $selectItem = new SelectItem(); + $selectItem->setId($id); + $selectProperty->content = $selectItem; + + $selectProperty->rawContent = [ + 'select' => [ + 'id' => $selectItem->getId(), + ], + ]; + + return $selectProperty; + } + /** * @param $name * @return Select