-
-
Save linotex/ab65b0f969cf99b7454d to your computer and use it in GitHub Desktop.
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
<?php | |
namespace MyBundle\Bundle\LabelBundle\Form\Type; | |
use Symfony\Component\Form\AbstractType; | |
use Symfony\Component\Form\FormBuilderInterface; | |
use Symfony\Component\OptionsResolver\OptionsResolverInterface; | |
class LabelType extends AbstractType | |
{ | |
public function buildForm (FormBuilderInterface $builder, array $options) | |
{ | |
$builder->add ( | |
'name', | |
'text', | |
[ | |
'label' => 'Label', | |
'required' => true, | |
] | |
); | |
} | |
public function setDefaultOptions(OptionsResolverInterface $resolver) | |
{ | |
$resolver->setDefaults ([ | |
'data_class' => 'MyBundle\Bundle\LabelBundle\Entity\Label', | |
'intention' => 'label', | |
]); | |
} | |
/** | |
* Returns the name of this type. | |
* | |
* @return string The name of this type | |
*/ | |
public function getName () | |
{ | |
return 'mybundle_label'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment