80 lines
1.6 KiB
PHP
80 lines
1.6 KiB
PHP
<?php
|
||
|
||
namespace Trinity\Bundle\UserBundle\Form\Type;
|
||
|
||
use Symfony\Component\Form\AbstractType;
|
||
use Symfony\Component\Form\FormBuilderInterface;
|
||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
||
|
||
class UserFilterType extends AbstractType
|
||
{
|
||
protected $options = array(
|
||
'data_class' => 'FOS\UserBundle\Propel\User',
|
||
'name' => 'user_filter',
|
||
'csrf_protection' => false,
|
||
);
|
||
|
||
/**
|
||
* {@inheritdoc}
|
||
*/
|
||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||
{
|
||
$builder->add(
|
||
'username',
|
||
null,
|
||
array(
|
||
'label' => 'Username',
|
||
)
|
||
);
|
||
|
||
$builder->add(
|
||
'email',
|
||
'text',
|
||
array(
|
||
'label' => 'Email',
|
||
)
|
||
);
|
||
|
||
$builder->add(
|
||
'enabled',
|
||
'filter_boolean',
|
||
array(
|
||
'mapped' => false,
|
||
)
|
||
);
|
||
|
||
$builder->add(
|
||
'locked',
|
||
'filter_boolean',
|
||
array(
|
||
'mapped' => false,
|
||
)
|
||
);
|
||
|
||
$builder->add(
|
||
'group',
|
||
'model',
|
||
array(
|
||
'class' => 'FOS\UserBundle\Propel\Group',
|
||
'required' => false,
|
||
)
|
||
);
|
||
}
|
||
|
||
/**
|
||
* {@inheritdoc}
|
||
*/
|
||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
||
{
|
||
$resolver->setDefaults($this->options);
|
||
}
|
||
|
||
/**
|
||
* {@inheritdoc}
|
||
*/
|
||
public function getName()
|
||
{
|
||
return 'user_filter';
|
||
}
|
||
}
|