Completed
Push — master ( c383d4...4bbc60 )
by Scott
02:41
created

DriverConfig::getShippingCalculators()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php namespace Bedard\Shop\FormWidgets;
2
3
use Backend\Classes\FormWidgetBase;
4
use Bedard\Shop\Classes\DriverManager;
5
6
/**
7
 * DriverConfig Form Widget
8
 */
9
class DriverConfig extends FormWidgetBase
10
{
11
    /**
12
     * {@inheritDoc}
13
     */
14
    protected $defaultAlias = 'bedard_shop_driver_config';
15
16
    /**
17
     * {@inheritDoc}
18
     */
19
    public function init()
20
    {
21
    }
22
23
    /**
24
     * {@inheritDoc}
25
     */
26
    public function render()
27
    {
28
        $this->prepareVars();
29
        return $this->makePartial('driverconfig');
30
    }
31
32
    /**
33
     * Prepares the form widget view data
34
     */
35
    public function prepareVars()
36
    {
37
        $this->vars['calculators'] = $this->getShippingCalculators();
38
        $this->vars['name'] = $this->formField->getName();
39
        $this->vars['value'] = $this->getLoadValue();
40
        $this->vars['model'] = $this->model;
41
    }
42
43
    /**
44
     * {@inheritDoc}
45
     */
46
    public function loadAssets()
47
    {
48
        $this->addCss('css/driverconfig.css', 'Bedard.Shop');
49
        $this->addJs('js/driverconfig.js', 'Bedard.Shop');
50
    }
51
52
    /**
53
     * {@inheritDoc}
54
     */
55
    public function getSaveValue($value)
56
    {
57
        return $value;
58
    }
59
60
    protected function getShippingCalculators()
61
    {
62
        $manager = DriverManager::instance();
63
64
        return $manager->getShippingDrivers();
65
    }
66
}
67