Completed
Push — master ( fdbeef...265a2d )
by jerome
21:34
created

GameType::buildForm()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 24
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 24
rs 8.9713
cc 1
eloc 20
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('installName', null, array('label' => 'game.fields.installName'))
29
            ->add('launchName', null, array('label' => 'game.fields.launchName'))
30
            ->add('bin', null, array('label' => 'game.fields.bin'))
31
            ->add('binDir', null, array('label' => 'game.fields.binDir'))
32
            ->add('orangebox', null, array('label' => 'game.fields.isOrangebox', 'required' => false))
33
            ->add('source', null, array('label' => 'game.fields.isSource', 'required' => false))
34
            ->add('steamCmd', null, array('label' => 'game.fields.isSteamCmd', 'required' => false))
35
            ->add('appId', null, array('label' => 'game.fields.appId'))
36
            ->add('appMod', null, array('label' => 'game.fields.appMod'))
37
            ->add('map', null, array('label' => 'game.fields.map'))
38
            ->add('configTemplate', null, array('label' => 'game.fields.configTemplate'))
39
            ->add('sourceImagesMaps', null, array('label' => 'game.fields.sourceImagesMaps'))
40
            ->add('plugins', null, array('label' => 'game.fields.plugins', 'required' => false))
41
            ->add('type', 'choice', array(
42
                'choices' => array('steam' => 'Steam', 'minecraft' => 'Minecraft'), 
43
                'label' => 'game.fields.type', 
44
            ))
45
            ->add('available', null, array('label' => 'game.fields.available', 'required' => false))
46
        ;
47
    }
48
    
49
    /**
50
     * @param OptionsResolverInterface $resolver
51
     */
52
    public function setDefaultOptions(OptionsResolverInterface $resolver)
53
    {
54
        $resolver->setDefaults(array(
55
            'data_class' => 'DP\Core\GameBundle\Entity\Game'
56
        ));
57
    }
58
59
    /**
60
     * @return string
61
     */
62
    public function getName()
63
    {
64
        return 'dedipanel_game';
65
    }
66
}
67