Skip to content

Commit

Permalink
addRemoveButton accepts Nette\Utils\Html (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
BigOHenry authored Nov 21, 2023
1 parent b89d552 commit 387a2cd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/Buttons/RemoveButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Contributte\FormMultiplier\Multiplier;
use Nette\Forms\Controls\SubmitButton;
use Nette\SmartObject;
use Nette\Utils\Html;

final class RemoveButton
{
Expand All @@ -14,12 +15,12 @@ final class RemoveButton
/** @var callable[] */
public array $onCreate = [];

private ?string $caption = null;
private Html|string|null $caption = null;

/** @var string[] */
private array $classes = [];

public function __construct(?string $caption)
public function __construct(Html|string|null $caption)
{
$this->caption = $caption;
}
Expand Down
3 changes: 2 additions & 1 deletion src/Multiplier.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Nette\Forms\Form;
use Nette\Utils\ArrayHash;
use Nette\Utils\Arrays;
use Nette\Utils\Html;
use Traversable;

class Multiplier extends Container
Expand Down Expand Up @@ -153,7 +154,7 @@ public function getCopyNumber(): int
return $this->copyNumber;
}

public function addRemoveButton(?string $caption = null): RemoveButton
public function addRemoveButton(Html|string|null $caption = null): RemoveButton
{
return $this->removeButton = new RemoveButton($caption);
}
Expand Down

0 comments on commit 387a2cd

Please sign in to comment.