1 | <?php |
||
2 | |||
3 | namespace SilverStripe\Fontpicker\Forms; |
||
4 | |||
5 | use SilverStripe\Forms\SingleSelectField; |
||
6 | use SilverStripe\View\Requirements; |
||
7 | |||
8 | class FontPickerField extends SingleSelectField |
||
9 | { |
||
10 | /** |
||
11 | * Defines the default font |
||
12 | * |
||
13 | * @config |
||
14 | * @var array |
||
15 | */ |
||
16 | protected static $default_font = 'nunito-sans'; |
||
17 | |||
18 | public function getDefaultFont() |
||
19 | { |
||
20 | return $this->owner->config()->get('default_font'); |
||
0 ignored issues
–
show
The property
owner does not exist on SilverStripe\Fontpicker\Forms\FontPickerField . Since you implemented __get , consider adding a @property annotation.
![]() |
|||
21 | } |
||
22 | |||
23 | public function __construct($name, $title = null, $source = array(), $value = null) |
||
24 | { |
||
25 | parent::__construct($name, $title, $source, $value); |
||
26 | |||
27 | $this->addExtraClass('font-picker-field'); |
||
28 | } |
||
29 | |||
30 | public function getSchemaDataDefaults() |
||
31 | { |
||
32 | $schemaData = parent::getSchemaDataDefaults(); |
||
33 | |||
34 | $fonts = []; |
||
35 | foreach ($this->getSource() as $css => $title) { |
||
36 | $fonts[] = [ |
||
37 | 'CSSClass' => $css, |
||
38 | 'Title' => $title, |
||
39 | ]; |
||
40 | } |
||
41 | |||
42 | $schemaData['source'] = $fonts; |
||
43 | $schemaData['name'] = $this->getName(); |
||
44 | $schemaData['value'] = $this->Value(); |
||
45 | |||
46 | return $schemaData; |
||
47 | } |
||
48 | |||
49 | public function Value() |
||
50 | { |
||
51 | return parent::Value() ?: $this->getDefaultFont(); |
||
52 | } |
||
53 | } |
||
54 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.