83 lines
1.8 KiB
PHP
83 lines
1.8 KiB
PHP
<?php
|
||
|
||
namespace Trinity\Bundle\ContentManagerBundle\Form\Type;
|
||
|
||
use Symfony\Component\Form\AbstractType;
|
||
use Symfony\Component\Form\FormBuilderInterface;
|
||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||
|
||
class NavType extends AbstractType
|
||
{
|
||
/**
|
||
* {@inheritdoc}
|
||
*/
|
||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||
{
|
||
$builder->add(
|
||
'name',
|
||
'text',
|
||
array(
|
||
'required' => true,
|
||
'constraints' => array(
|
||
new NotBlank(),
|
||
),
|
||
)
|
||
);
|
||
|
||
$builder->add(
|
||
'title',
|
||
'text',
|
||
array(
|
||
'required' => true,
|
||
'constraints' => array(
|
||
new NotBlank(),
|
||
),
|
||
)
|
||
);
|
||
|
||
$builder->add(
|
||
'culture',
|
||
'text',
|
||
array(
|
||
'required' => true,
|
||
'constraints' => array(
|
||
new NotBlank(),
|
||
),
|
||
)
|
||
);
|
||
|
||
$builder->add(
|
||
'domain',
|
||
'text',
|
||
array(
|
||
'required' => true,
|
||
'attr' => array(
|
||
'data-help' => "Regex available, eg: regex:/.*\\.example.com/s",
|
||
),
|
||
'constraints' => array(
|
||
new NotBlank(),
|
||
),
|
||
)
|
||
);
|
||
}
|
||
|
||
/**
|
||
* {@inheritdoc}
|
||
*/
|
||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
||
{
|
||
$resolver->setDefaults(array(
|
||
'data_class' => 'Trinity\Bundle\ContentManagerBundle\Model\Nav',
|
||
));
|
||
}
|
||
|
||
/**
|
||
* {@inheritdoc}
|
||
*/
|
||
public function getName()
|
||
{
|
||
return 'nav';
|
||
}
|
||
}
|