• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

contributte / forms-multiplier / 5574364510

pending completion
5574364510

push

github

f3l1x
Composer: update dev deps

239 of 321 relevant lines covered (74.45%)

10.95 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

84.62
/src/Buttons/RemoveButton.php
1
<?php declare(strict_types = 1);
2

3
namespace Contributte\FormMultiplier\Buttons;
4

5
use Contributte\FormMultiplier\Multiplier;
6
use Nette\Forms\Controls\SubmitButton;
7
use Nette\SmartObject;
8

9
final class RemoveButton
10
{
11

12
        use SmartObject;
13

14
        /** @var callable[] */
15
        public array $onCreate = [];
16

17
        private ?string $caption = null;
18

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

22
        public function __construct(?string $caption)
23
        {
24
                $this->caption = $caption;
16✔
25
        }
26

27
        public function addOnCreateCallback(callable $onCreate): self
28
        {
29
                $this->onCreate[] = $onCreate;
3✔
30

31
                return $this;
3✔
32
        }
33

34
        public function addClass(string $class): self
35
        {
36
                $this->classes[] = $class;
×
37

38
                return $this;
×
39
        }
40

41
        public function create(Multiplier $multiplier): SubmitButton
42
        {
43
                $button = new SubmitButton($this->caption);
16✔
44

45
                $button->setHtmlAttribute('class', implode(' ', $this->classes));
16✔
46
                $button->setValidationScope([])
16✔
47
                        ->setOmitted();
16✔
48

49
                $button->onClick[] = $button->onInvalidClick[] = [$multiplier, 'resetFormEvents'];
16✔
50

51
                foreach ($this->onCreate as $callback) {
16✔
52
                        $callback($button);
3✔
53
                }
54

55
                return $button;
16✔
56
        }
57

58
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc