80 lines
3.2 KiB
PHP
80 lines
3.2 KiB
PHP
<?php
|
|
namespace Cadoles\CoreBundle\Form;
|
|
|
|
use Symfony\Component\Form\AbstractType;
|
|
use Symfony\Component\Form\FormBuilderInterface;
|
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
|
use Symfony\Component\Form\Extension\Core\Type\EmailType;
|
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
|
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
|
|
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
|
|
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
|
use Symfony\Component\Form\Extension\Core\Type\ButtonType;
|
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
|
use Symfony\Component\Form\Extension\Core\Type\ColorType;
|
|
use Cadoles\CoreBundle\Form\IconChoiceType;
|
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
|
use Ivory\CKEditorBundle\Form\Type\CKEditorType;
|
|
use Tetranz\Select2EntityBundle\Form\Type\Select2EntityType;
|
|
|
|
use Doctrine\ORM\EntityRepository;
|
|
use Doctrine\ORM\EntityManager;
|
|
|
|
class ScrumType extends AbstractType
|
|
{
|
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
|
{
|
|
if($options["mode"]!="view") {
|
|
$builder
|
|
->add('submit', SubmitType::class, [
|
|
'label' => 'Valider',
|
|
'attr' => ['class' => 'btn btn-success']
|
|
]);
|
|
|
|
$builder
|
|
->add('title', TextType::class, [
|
|
'label' => 'Titre',
|
|
'attr' => ['class' => 'form-control', 'style' => 'margin-bottom:15px']
|
|
]);
|
|
|
|
|
|
$builder
|
|
->add('groups', Select2EntityType::class, [
|
|
'label' => 'Visible pour les Groupes',
|
|
'class' => 'CadolesCoreBundle:Group',
|
|
'text_property' => 'label',
|
|
'multiple' => true,
|
|
'remote_route' => 'cadoles_core_user_group_ajax_list',
|
|
'primary_key' => 'id',
|
|
'text_property' => 'label',
|
|
'minimum_input_length' => 0,
|
|
'page_limit' => 100,
|
|
'allow_clear' => true,
|
|
'delay' => 250,
|
|
'cache' => false,
|
|
'cache_timeout' => 60000,
|
|
'language' => 'fr',
|
|
'placeholder' => 'Selectionner un groupe',
|
|
]);
|
|
}
|
|
else {
|
|
$builder
|
|
->add('description',CKEditorType::class,[
|
|
'config_name' => 'full_config',
|
|
'label' => 'Description',
|
|
'mapped' => false,
|
|
'required' => false,
|
|
'config' => ['height' => '300px','filebrowserUploadRoute' => 'cadoles_core_user_scrum_upload'],
|
|
]);
|
|
}
|
|
}
|
|
|
|
public function configureOptions(OptionsResolver $resolver)
|
|
{
|
|
$resolver->setDefaults(array(
|
|
'data_class' => 'Cadoles\CoreBundle\Entity\Scrum',
|
|
'mode' => "string"
|
|
));
|
|
}
|
|
}
|