Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
Tool
n/a
0 / 0
n/a
0 / 0
0
n/a
0 / 0
1<?php
2
3declare(strict_types=1);
4
5namespace Cosray\Schema;
6
7/**
8 * The richtext toolbar vocabulary. `#[Tools]` and the `richtext.tools`
9 * config key pick from these cases; the panel renders whatever is picked
10 * in its own canonical order, so the list is a set, not a layout.
11 */
12enum Tool: string
13{
14    case Undo = 'undo';
15    case Redo = 'redo';
16    case H1 = 'h1';
17    case H2 = 'h2';
18    case H3 = 'h3';
19    case Bold = 'bold';
20    case Italic = 'italic';
21    case Strike = 'strike';
22    case Sub = 'sub';
23    case Sup = 'sup';
24    case Align = 'align';
25    case BulletList = 'bullet-list';
26    case OrderedList = 'ordered-list';
27    case Blockquote = 'blockquote';
28    case Hr = 'hr';
29    case Link = 'link';
30    case Image = 'image';
31    case Br = 'br';
32    case Clear = 'clear';
33    case Source = 'source';
34
35    /**
36     * The built-in toolbar: what editors get unless a field's `#[Tools]`
37     * or the project's `richtext.tools` asks for more. A constant, not a
38     * method, so it can seed an attribute: `#[Tools(Tool::DEFAULT, Tool::Align)]`.
39     */
40    public const array DEFAULT = [
41        self::Undo,
42        self::Redo,
43        self::Bold,
44        self::Italic,
45        self::Strike,
46        self::H2,
47        self::H3,
48        self::BulletList,
49        self::OrderedList,
50        self::Link,
51    ];
52
53    /** A bare trio for teaser-sized fields. */
54    public const array MINIMAL = [self::Bold, self::Italic, self::Link];
55
56    /**
57     * Every tool there is. Spelled out because a constant cannot call
58     * `cases()`; a test pins it to the case list.
59     */
60    public const array ALL = [
61        self::Undo,
62        self::Redo,
63        self::H1,
64        self::H2,
65        self::H3,
66        self::Bold,
67        self::Italic,
68        self::Strike,
69        self::Sub,
70        self::Sup,
71        self::Align,
72        self::BulletList,
73        self::OrderedList,
74        self::Blockquote,
75        self::Hr,
76        self::Link,
77        self::Image,
78        self::Br,
79        self::Clear,
80        self::Source,
81    ];
82}