diff --git a/src/Services/Forms/InlineRepeater.php b/src/Services/Forms/InlineRepeater.php index 9ae9fec138..0e7a19080c 100644 --- a/src/Services/Forms/InlineRepeater.php +++ b/src/Services/Forms/InlineRepeater.php @@ -27,6 +27,8 @@ protected function __construct( private ?bool $allowBrowse = false, private ?array $browser = null, private ?int $max = null, + private ?string $titleField = null, + private ?bool $hideTitlePrefix = false, ) { } @@ -44,6 +46,20 @@ public function selectTriggerText(string $selectTrigger): static return $this; } + public function titleField(string $field): static + { + $this->titleField = $field; + + return $this; + } + + public function hideTitlePrefix(bool $hide = true): static + { + $this->hideTitlePrefix = $hide; + + return $this; + } + public static function make(): self { $self = new self(); @@ -160,6 +176,8 @@ public function asBlock(): Block $repeaterBlock->trigger = $this->trigger ?? 'Add ' . $this->label; $repeaterBlock->selectTrigger = $this->selectTrigger ?? 'Select ' . $this->label; $repeaterBlock->group = 'dynamic'; + $repeaterBlock->titleField = $this->titleField; + $repeaterBlock->hideTitlePrefix = $this->hideTitlePrefix; return $repeaterBlock; }