-
Notifications
You must be signed in to change notification settings - Fork 178
Expand file tree
/
Copy pathButtonTypeExtension.php
More file actions
62 lines (55 loc) · 1.64 KB
/
ButtonTypeExtension.php
File metadata and controls
62 lines (55 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
namespace Braincrafted\Bundle\BootstrapBundle\Form\Extension;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\FormView;
use Symfony\Component\Form\FormInterface;
use Braincrafted\Bundle\BootstrapBundle\Util\LegacyFormHelper;
/**
* FormControlStaticType
*
* @package BraincraftedBootstrapBundle
* @subpackage Form
* @author André Püschel <pue@der-pue.de>
* @copyright 2014 André Püschel
* @license http://opensource.org/licenses/MIT The MIT License
* @link http://bootstrap.braincrafted.com Bootstrap for Symfony2
*/
class ButtonTypeExtension extends AbstractTypeExtension
{
/**
* {@inheritDoc}
*/
public function buildView(FormView $view, FormInterface $form, array $options)
{
$view->vars['button_class'] = $form->getConfig()->getOption('button_class');
$view->vars['as_link'] = $form->getConfig()->getOption('as_link');
}
/**
* Add the button_class option
* Add the as_link option
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefined(array('button_class', 'as_link'));
}
/**
* {@inheritdoc}
*/
public function getExtendedType()
{
// map old class to new one using LegacyFormHelper
return LegacyFormHelper::getType('button');
}
/**
* {@inheritdoc}
*/
public static function getExtendedTypes()
{
return array(
// map old class to new one using LegacyFormHelper
LegacyFormHelper::getType('button')
);
}
}