Issues (35)

src/Traits/CMSNicetiesTraitForRightTitles.php (1 issue)

1
<?php
2
3
namespace Sunnysideup\CMSNiceties\Traits;
4
5
// use SilverStripe\Forms\GridField\GridFieldArchiveAction;
6
7
trait CMSNicetiesTraitForRightTitles
8
{
9
    public function addRightTitles($fields)
10
    {
11
        $rightFieldDescriptions = $this->Config()->get('field_labels_right');
0 ignored issues
show
It seems like Config() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

11
        $rightFieldDescriptions = $this->/** @scrutinizer ignore-call */ Config()->get('field_labels_right');
Loading history...
12
        if (is_array($rightFieldDescriptions) && count($rightFieldDescriptions)) {
13
            foreach ($rightFieldDescriptions as $field => $desc) {
14
                $formField = $fields->DataFieldByName($field);
15
                if (! $formField) {
16
                    $formField = $fields->DataFieldByName($field . 'ID');
17
                }
18
19
                if ($formField) {
20
                    $formField->setDescription($desc);
21
                }
22
            }
23
        }
24
25
        //...
26
    }
27
}
28