Completed
Push — master ( 265a2d...f9e310 )
by jerome
02:58
created

GameType::buildForm()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 6
Bugs 0 Features 0
Metric Value
c 6
b 0
f 0
dl 0
loc 22
rs 9.2
cc 1
eloc 18
nc 1
nop 2
1
<?php
2
3
/**
4
 * This file is part of Dedipanel project
5
 *
6
 * (c) 2010-2015 Dedipanel <http://www.dedicated-panel.net>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace DP\Core\GameBundle\Form;
13
14
use Symfony\Component\Form\AbstractType;
15
use Symfony\Component\Form\FormBuilderInterface;
16
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
17
18
class GameType extends AbstractType
19
{
20
    /**
21
     * @param FormBuilderInterface $builder
22
     * @param array $options
23
     */
24
    public function buildForm(FormBuilderInterface $builder, array $options)
25
    {
26
        $builder
27
            ->add('name', null, array('label' => 'game.fields.name'))
28
            ->add('launchName', null, array('label' => 'game.fields.launchName'))
29
            ->add('bin', null, array('label' => 'game.fields.bin'))
30
            ->add('binDir', null, array('label' => 'game.fields.binDir'))
31
            ->add('cfgPath', null, array('label' => 'game.fields.cfgPath', 'required' => false))
32
            ->add('source', null, array('label' => 'game.fields.isSource', 'required' => false))
33
            ->add('appId', null, array('label' => 'game.fields.appId'))
34
            ->add('appMod', null, array('label' => 'game.fields.appMod'))
35
            ->add('map', null, array('label' => 'game.fields.map'))
36
            ->add('configTemplate', null, array('label' => 'game.fields.configTemplate'))
37
            ->add('sourceImagesMaps', null, array('label' => 'game.fields.sourceImagesMaps'))
38
            ->add('plugins', null, array('label' => 'game.fields.plugins', 'required' => false))
39
            ->add('type', 'dictionary', array(
40
                'name'  => 'game_type',
41
                'label' => 'game.fields.type', 
42
            ))
43
            ->add('available', null, array('label' => 'game.fields.available', 'required' => false))
44
        ;
45
    }
46
    
47
    /**
48
     * @param OptionsResolverInterface $resolver
49
     */
50
    public function setDefaultOptions(OptionsResolverInterface $resolver)
51
    {
52
        $resolver->setDefaults(array(
53
            'data_class' => 'DP\Core\GameBundle\Entity\Game'
54
        ));
55
    }
56
57
    /**
58
     * @return string
59
     */
60
    public function getName()
61
    {
62
        return 'dedipanel_game';
63
    }
64
}
65