updateSettingsFields()   B
last analyzed

Complexity

Conditions 5
Paths 6

Size

Total Lines 19
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 8.8571
c 0
b 0
f 0
cc 5
eloc 13
nc 6
nop 1
1
<?php
2
3
/**
4
 *@author nicolaas[at]sunnysideup.co.nz
5
 *@description: adds functionality to controller for dev purposes only
6
 *
7
 **/
8
9
10
class TemplateoverviewPageDecorator extends SiteTreeExtension
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
11
{
12
    public function updateSettingsFields(FieldList $fields)
13
    {
14
        if ($this->owner->hasMethod('getHowToMakeThisTemplateWorkArray')) {
15
            $array = $this->owner->getHowToMakeThisTemplateWorkArray();
16
            if (is_array($array) && count($array)) {
17
                $fields->addFieldToTab("Root.Help", new LiteralField(
18
                    "HowToMakeThisPageWork",
19
                    '<h3 id="HowToMakeThisPageWorkHeader">'._t("TemplateoverviewPageDecorator.HOWTOMAKEITWORKHEADER", "How to make this page work").'</h3>'
20
                        .'<ul id="HowToMakeThisPageWorkList"><li>'.implode("</li><li>", $array).'</li></ul>'
21
                ));
22
            }
23
        }
24
        $obj = TemplateoverviewDescription::get()
25
            ->filter(array("ClassNameLink" => $this->owner->ClassName))
26
            ->First();
27
        if ($obj) {
28
            $fields->addFieldToTab("Root.Help", new LiteralField("MoreHelp", $obj->renderWith("TemplateoverviewPageCMSDetail")));
29
        }
30
    }
31
}
32