Passed
Pull Request — master (#6)
by Robbie
04:46 queued 02:00
created

CwpHtmlEditorConfig   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 18
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getHtmlEditorConfig() 0 9 2
1
<?php
2
3
namespace CWP\Core\Extension;
4
5
use SilverStripe\ORM\DataExtension;
6
7
class CwpHtmlEditorConfig extends DataExtension
8
{
9
10
    /**
11
     * @return string
12
     *
13
     * Override the default HtmlEditorConfig from 'cms' to 'cwp' defined in cwp-core/_config.php
14
     * However if the group has a custom editor configuration set, use that instead.
15
     */
16
    public function getHtmlEditorConfig()
17
    {
18
        $originalConfig = $this->owner->getField("HtmlEditorConfig");
19
20
        if ($originalConfig) {
21
            return $originalConfig;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $originalConfig also could return the type object which is incompatible with the documented return type string.
Loading history...
22
        }
23
24
        return 'cwp';
25
    }
26
}
27