Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/Services/Forms/InlineRepeater.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ protected function __construct(
private ?int $max = null,
private ?string $titleField = null,
private ?bool $hideTitlePrefix = false,
private ?bool $buttonAsLink = false
) {
}

Expand Down Expand Up @@ -149,6 +150,13 @@ public function max(int $max): static
return $this;
}

public function buttonAsLink(bool $buttonAsLink = true): static
{
$this->buttonAsLink = $buttonAsLink;

return $this;
}

public function renderForm(): View
{
return view('twill::partials.form.renderer.block_form', [
Expand Down Expand Up @@ -203,6 +211,10 @@ public function render(): View
$repeater->max($this->max);
}

if ($this->buttonAsLink) {
$repeater->buttonAsLink($this->buttonAsLink);
}

$repeater->renderForBlocks = $this->renderForBlocks ?? false;
return $repeater->render();
}
Expand Down