Completed
Push — master ( 6c0568...dd7294 )
by Robbie
13s
created

code/ContentWidget.php (7 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/**
4
 * Content Widget
5
 *
6
 * @package silverstripe-content-widget
7
 */
8
class ContentWidget extends Widget
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...
9
{
10
    /**
11
     * @var array
12
     */
13
    public static $db = array(
14
        "HTML" => "HTMLText"
15
    );
16
17
    /**
18
     * @var string
19
     */
20
    private static $title = "HTML Content";
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
The property $title is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
21
22
    /**
23
     * @var string
24
     */
25
    private static $cmsTitle = "HTML Content";
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
The property $cmsTitle is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
26
27
    /**
28
     * @var string
29
     */
30
    private static $description = "Custom HTML content widget.";
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
The property $description is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
31
32
    /**
33
     * @return FieldList
34
     */
35
    public function getCMSFields()
36
    {
37
        $fields = parent::getCMSFields();
38
39
        $fields->push(TextField::create("Title"));
40
        $fields->push(HtmlEditorField::create("HTML", "Content"));
41
42
        return $fields;
43
    }
44
}
45