Total Complexity | 5 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
7 | class FontPickerField extends SingleSelectField |
||
8 | { |
||
9 | /** |
||
10 | * The default value if none is already configured |
||
11 | * |
||
12 | * @var string |
||
13 | */ |
||
14 | const DEFAULT_VALUE = 'nunito-sans'; |
||
15 | |||
16 | public function __construct($name, $title = null, $source = array(), $value = null) |
||
17 | { |
||
18 | parent::__construct($name, $title, $source, $value); |
||
19 | |||
20 | $this->addExtraClass('font-picker-field'); |
||
21 | } |
||
22 | |||
23 | public function getSchemaDataDefaults() |
||
24 | { |
||
25 | $schemaData = parent::getSchemaDataDefaults(); |
||
26 | |||
27 | $fonts = []; |
||
28 | foreach ($this->getSource() as $css => $title) { |
||
29 | $fonts[] = [ |
||
30 | 'CSSClass' => $css, |
||
31 | 'Title' => $title, |
||
32 | ]; |
||
33 | } |
||
34 | |||
35 | $schemaData['source'] = $fonts; |
||
36 | $schemaData['name'] = $this->getName(); |
||
37 | $schemaData['value'] = $this->Value(); |
||
38 | |||
39 | return $schemaData; |
||
40 | } |
||
41 | |||
42 | public function Value() |
||
45 | } |
||
46 | } |
||
47 |