1 | <?php |
||
2 | |||
3 | namespace LeKoala\Blocks\Fields; |
||
4 | |||
5 | use SilverStripe\View\Parsers\HTMLValue; |
||
6 | use SilverStripe\ORM\DataObjectInterface; |
||
7 | use SilverStripe\Forms\HTMLEditor\HTMLEditorField; |
||
8 | use SilverStripe\Forms\HTMLEditor\HTMLEditorConfig; |
||
9 | use SilverStripe\Forms\HTMLEditor\HTMLEditorSanitiser; |
||
10 | |||
11 | /** |
||
12 | * This simple extension allow storing the html into json |
||
13 | * and relies on our hijacked setCastedField method to save the html |
||
14 | */ |
||
15 | class BlockHTMLEditorField extends HTMLEditorField |
||
16 | { |
||
17 | public function extraClass() |
||
18 | { |
||
19 | return 'htmleditor ' . parent::extraClass(); |
||
20 | } |
||
21 | |||
22 | /** |
||
23 | * @param DataObject|DataObjectInterface $record |
||
0 ignored issues
–
show
|
|||
24 | * @throws Exception |
||
25 | */ |
||
26 | public function saveInto(DataObjectInterface $record) |
||
27 | { |
||
28 | // Sanitise if requested |
||
29 | $htmlValue = HTMLValue::create($this->Value()); |
||
30 | if (HTMLEditorField::config()->sanitise_server_side) { |
||
31 | $santiser = HTMLEditorSanitiser::create(HTMLEditorConfig::get_active()); |
||
32 | $santiser->sanitise($htmlValue); |
||
33 | } |
||
34 | |||
35 | // optionally manipulate the HTML after a TinyMCE edit and prior to a save |
||
36 | $this->extend('processHTML', $htmlValue); |
||
37 | |||
38 | // Store into record |
||
39 | $record->setCastedField($this->name, $htmlValue->getContent()); |
||
40 | } |
||
41 | } |
||
42 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths