TemplateoverviewPageDecorator   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 6
dl 0
loc 22
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B updateSettingsFields() 0 19 5
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