Skip to content

Instantly share code, notes, and snippets.

@linotex
Created February 26, 2015 17:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save linotex/ab65b0f969cf99b7454d to your computer and use it in GitHub Desktop.
Save linotex/ab65b0f969cf99b7454d to your computer and use it in GitHub Desktop.
<?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