-
Notifications
You must be signed in to change notification settings - Fork 554
/
BlockEditor.php
65 lines (48 loc) · 1.39 KB
/
BlockEditor.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
namespace A17\Twill\Services\Forms\Fields;
class BlockEditor extends BaseFormField
{
protected array $blocks = [];
protected array $excludeBlocks = [];
protected bool $isSettings = false;
protected bool $withoutSeparator = false;
public static function make(): static
{
$field = new self(\A17\Twill\View\Components\Fields\BlockEditor::class);
$field->name('default');
return $field;
}
public function name(string $name): static
{
if ($this->label === null) {
$this->label = twillTrans('twill::lang.fields.block-editor.add-content');
}
return parent::name($name);
}
public function withoutSeparator(bool $withoutSeparator = true): static
{
$this->withoutSeparator = $withoutSeparator;
return $this;
}
public function isSettings(bool $isSettings = true): static
{
$this->isSettings = $isSettings;
return $this;
}
/**
* Default is all, but using this method you can limit the block types the field can use.
*/
public function blocks(array $blocks): static
{
$this->blocks = $blocks;
return $this;
}
/**
* Use this method if you want to exclude any block types
*/
public function excludeBlocks(array $blocks): static
{
$this->excludeBlocks = $blocks;
return $this;
}
}