PluginProbe
Simple Analytics / 1.28
Simple Analytics v1.28
1.109 1.108 1.107 1.106 1.73 1.74 1.75 1.76 1.77 1.78 1.79 1.8 1.80 1.81 1.82 1.83 1.84 1.85 1.86 1.87 1.88 1.89 1.9 1.90 1.91 All 98 releases
simpleanalytics / src / Settings / Concerns / ManagesBlocks.php

ManagesBlocks.php in Simple Analytics 1.28, at src/Settings/Concerns/ManagesBlocks.php

51 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace SimpleAnalytics\Settings\Concerns;
4
5 use SimpleAnalytics\Settings\Block;
6 use SimpleAnalytics\Settings\Blocks\CalloutBlock;
7 use SimpleAnalytics\Settings\Blocks\Fields\Checkbox;
8 use SimpleAnalytics\Settings\Blocks\Fields\Checkboxes;
9 use SimpleAnalytics\Settings\Blocks\Fields\Input;
10 use SimpleAnalytics\Settings\Blocks\Fields\IpList;
11
12 trait ManagesBlocks
13 {
14 abstract protected function addBlock(Block $block): self;
15
16 public function callout(string $text): CalloutBlock
17 {
18 $block = new CalloutBlock($text);
19 $this->addBlock($block);
20 return $block;
21 }
22
23 public function input(string $key, string $label): Input
24 {
25 $field = new Input($key, $label);
26 $this->addBlock($field);
27 return $field;
28 }
29
30 public function checkbox(string $key, string $label): Checkbox
31 {
32 $field = new Checkbox($key, $label);
33 $this->addBlock($field);
34 return $field;
35 }
36
37 public function multiCheckbox(string $key, string $label): Checkboxes
38 {
39 $field = new Checkboxes($key, $label);
40 $this->addBlock($field);
41 return $field;
42 }
43
44 public function ipList(string $key, string $label): IpList
45 {
46 $field = new IpList($key, $label);
47 $this->addBlock($field);
48 return $field;
49 }
50 }
51