for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?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 <[email protected]>
* @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'));
public function getExtendedType()
// map old class to new one using LegacyFormHelper
return LegacyFormHelper::getType('button');