Passed
Pull Request — master (#56)
by Marco
17:30 queued 07:16
created

ElevationField   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 29
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getAttributes() 0 16 1
1
<?php
2
3
namespace Firesphere\SolrSearch\Forms;
4
5
use SilverStripe\Forms\FormField;
6
7
class ElevationField extends FormField
8
{
9
    private static $default_classes = ['elevation-field'];
0 ignored issues
show
introduced by
The private property $default_classes is not used, and could be removed.
Loading history...
10
11
    protected $schemaDataType = FormField::SCHEMA_DATA_TYPE_CUSTOM;
12
13
    protected $schemaComponent = 'ElevationField';
14
15
    /**
16
     * Attributes to be given for this field type.
17
     *
18
     * @return array
19
     */
20
    public function getAttributes()
21
    {
22
        $attributes = [
23
            'class'       => $this->extraClass(),
24
            'id'          => $this->ID(),
25
            'name'        => $this->getName(),
26
            'value'       => $this->Value(),
27
            'data-schema' => json_encode($this->getSchemaData()),
28
            'data-state'  => json_encode($this->getSchemaState()),
29
        ];
30
31
        $attributes = array_merge($attributes, $this->attributes);
32
33
        $this->extend('updateAttributes', $attributes);
34
35
        return $attributes;
36
    }
37
}
38