-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fixes double 'type' in markup bug * allows usage of BS-Button styled <a>-Tag * (+1 squashed commits) Squashed commits: [6f1d0e4] renaming button extensions new options for better clarity
- Loading branch information
Showing
3 changed files
with
58 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
namespace Braincrafted\Bundle\BootstrapBundle\Form\Extension; | ||
|
||
use Symfony\Component\Form\AbstractTypeExtension; | ||
use Symfony\Component\OptionsResolver\OptionsResolverInterface; | ||
use Symfony\Component\Form\FormView; | ||
use Symfony\Component\Form\FormInterface; | ||
|
||
/** | ||
* 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'); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function setDefaultOptions(OptionsResolverInterface $resolver) | ||
{ | ||
$resolver->setOptional(array('button_class', 'as_link')); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getExtendedType() | ||
{ | ||
return 'button'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters