Completed
Push — master ( 4e3396...61149e )
by Piotr
12s
created

GenericResourceElement::configureOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
3
/**
4
 * (c) FSi sp. z o.o. <[email protected]>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace FSi\Bundle\AdminBundle\Admin\ResourceRepository;
11
12
use FSi\Bundle\AdminBundle\Admin\AbstractElement;
13
use Symfony\Component\OptionsResolver\OptionsResolver;
14
15
abstract class GenericResourceElement extends AbstractElement implements Element
16
{
17
    /**
18
     * {@inheritdoc}
19
     */
20
    public function getRoute()
21
    {
22
        return 'fsi_admin_resource';
23
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function getRouteParameters()
29
    {
30
        return [
31
            'element' => $this->getId(),
32
        ];
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function getSuccessRoute()
39
    {
40
        return $this->getRoute();
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46
    public function getSuccessRouteParameters()
47
    {
48
        return $this->getRouteParameters();
49
    }
50
51
    /**
52
     * {@inheritdoc}
53
     */
54
    abstract public function getKey();
55
56
    /**
57
     * @return array
58
     */
59
    public function getResourceFormOptions()
60
    {
61
        return [];
62
    }
63
64
    /**
65
     * {@inheritdoc}
66
     */
67
    public function configureOptions(OptionsResolver $resolver)
68
    {
69
        $resolver->setDefaults([
70
            'template' => null,
71
        ]);
72
73
        $resolver->setAllowedTypes('template', ['null', 'string']);
74
    }
75
}
76