mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
stored object: add has_title option to form type of StoredObject
This commit is contained in:
parent
dea554ced4
commit
e8cf7ae8e1
@ -313,6 +313,7 @@ class ActivityType extends AbstractType
|
||||
'button_add_label' => 'activity.Insert a document',
|
||||
'button_remove_label' => 'activity.Remove a document',
|
||||
'empty_collection_explain' => 'No documents',
|
||||
'entry_options' => ['has_title' => true],
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\CallbackTransformer;
|
||||
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
@ -64,12 +65,21 @@ class StoredObjectType extends AbstractType
|
||||
[$this, 'transformObject'],
|
||||
[$this, 'reverseTransformObject']
|
||||
));
|
||||
|
||||
if ($options['has_title']) {
|
||||
$builder
|
||||
->add('title', TextType::class);
|
||||
}
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver
|
||||
->setDefault('data_class', StoredObject::class);
|
||||
|
||||
$resolver
|
||||
->setDefault('has_title', false)
|
||||
->addAllowedValues('has_title', [true, false]);
|
||||
}
|
||||
|
||||
public function getBlockPrefix()
|
||||
|
Loading…
x
Reference in New Issue
Block a user