Passed
Push — master ( b91912...ff5896 )
by Robbie
07:30 queued 10s
created

ElementalCMSMainExtension   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 14
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A updateSearchForm() 0 6 2
1
<?php
2
3
namespace DNADesign\Elemental\Extensions;
4
5
use SilverStripe\Core\Extension;
6
use SilverStripe\Forms\DropdownField;
7
use SilverStripe\Forms\Form;
8
9
class ElementalCMSMainExtension extends Extension
10
{
11
    /**
12
     * Remove the empty default string on the class filter, which adds "All pages" again. This is already
13
     * added by ElementSiteTreeFilterSearch.
14
     *
15
     * @param Form $form
16
     */
17
    public function updateSearchForm(Form $form)
18
    {
19
        /** @var DropdownField $filterField */
20
        $filterField = $form->Fields()->fieldByName('Search__FilterClass');
21
        if ($filterField) {
0 ignored issues
show
introduced by Robbie Averill
$filterField is of type SilverStripe\Forms\DropdownField, thus it always evaluated to true.
Loading history...
22
            $filterField->setEmptyString('')->setHasEmptyDefault(false);
23
        }
24
    }
25
}
26