deblan.tv/vendor/trinity/src/Trinity/Bundle/ContentManagerBundle/Form/Type/NavType.php

83 lines
1.8 KiB
PHP
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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';
}
}