summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
6bdbe1c)
Match parent prototypes
Cleanup
- public function buildForm(FormBuilderInterface $builder, array $options) {
- //Create form
- $form = $builder;
-
+ public function buildForm(FormBuilderInterface $builder, array $options): void {
- $form->add('dance', EntityType::class, ['class' => 'Rapsys\AirBundle\Entity\Dance', 'choices' => $options['dance_choices'], 'preferred_choices' => $options['dance_favorites'], 'attr' => ['placeholder' => 'Your dance'], 'choice_translation_domain' => true, 'constraints' => [new NotBlank(['message' => 'Please provide your dance'])], 'data' => $options['dance_default']]);
+ $builder->add('dance', EntityType::class, ['class' => 'Rapsys\AirBundle\Entity\Dance', 'choices' => $options['dance_choices'], 'preferred_choices' => $options['dance_favorites'], 'attr' => ['placeholder' => 'Your dance'], 'choice_translation_domain' => true, 'constraints' => [new NotBlank(['message' => 'Please provide your dance'])], 'data' => $options['dance_default']]);
- $form->add('date', DateType::class, ['attr' => ['placeholder' => 'Your date', 'class' => 'date'], 'html5' => true, 'input' => 'datetime', 'widget' => 'single_text', 'format' => 'yyyy-MM-dd', 'data' => new \DateTime('+7 day'), 'constraints' => [new NotBlank(['message' => 'Please provide your date']), new Type(['type' => \DateTime::class, 'message' => 'Your date doesn\'t seems to be valid'])]]);
+ $builder->add('date', DateType::class, ['attr' => ['placeholder' => 'Your date', 'class' => 'date'], 'html5' => true, 'input' => 'datetime', 'widget' => 'single_text', 'format' => 'yyyy-MM-dd', 'data' => new \DateTime('+7 day'), 'constraints' => [new NotBlank(['message' => 'Please provide your date']), new Type(['type' => \DateTime::class, 'message' => 'Your date doesn\'t seems to be valid'])]]);
- $form->add('location', EntityType::class, ['class' => 'Rapsys\AirBundle\Entity\Location', 'choices' => $options['location_choices'], 'preferred_choices' => $options['location_favorites'], 'attr' => ['placeholder' => 'Your location'], 'choice_translation_domain' => true, 'constraints' => [new NotBlank(['message' => 'Please provide your location'])], 'data' => $options['location_default']]);
+ $builder->add('location', EntityType::class, ['class' => 'Rapsys\AirBundle\Entity\Location', 'choices' => $options['location_choices'], 'preferred_choices' => $options['location_favorites'], 'attr' => ['placeholder' => 'Your location'], 'choice_translation_domain' => true, 'constraints' => [new NotBlank(['message' => 'Please provide your location'])], 'data' => $options['location_default']]);
- $form->add('slot', EntityType::class, ['class' => 'Rapsys\AirBundle\Entity\Slot', 'attr' => ['placeholder' => 'Your slot'], 'constraints' => [new NotBlank(['message' => 'Please provide your slot'])], 'choice_translation_domain' => true, 'data' => $options['slot_default']]);
+ $builder->add('slot', EntityType::class, ['class' => 'Rapsys\AirBundle\Entity\Slot', 'attr' => ['placeholder' => 'Your slot'], 'constraints' => [new NotBlank(['message' => 'Please provide your slot'])], 'choice_translation_domain' => true, 'data' => $options['slot_default']]);
//Add extra user field
if (!empty($options['user'])) {
//XXX: choicetype used here to use our own custom translated string
//Add extra user field
if (!empty($options['user'])) {
//XXX: choicetype used here to use our own custom translated string
- $form->add('user', ChoiceType::class, ['attr' => ['placeholder' => 'Your user'], 'choice_translation_domain' => false, 'constraints' => [new NotBlank(['message' => 'Please provide your user'])], 'choices' => $options['user_choices'], 'data' => $options['user_default']]);
+ $builder->add('user', ChoiceType::class, ['attr' => ['placeholder' => 'Your user'], 'choice_translation_domain' => false, 'constraints' => [new NotBlank(['message' => 'Please provide your user'])], 'choices' => $options['user_choices'], 'data' => $options['user_default']]);
- $form->add('submit', SubmitType::class, ['label' => 'Send', 'attr' => ['class' => 'submit']]);
-
- //Return form
- return $form;
+ $builder->add('submit', SubmitType::class, ['label' => 'Send', 'attr' => ['class' => 'submit']]);
- public function configureOptions(OptionsResolver $resolver) {
+ public function configureOptions(OptionsResolver $resolver): void {
//Set defaults
$resolver->setDefaults(['error_bubbling' => true, 'dance_choices' => [], 'dance_default' => null, 'dance_favorites' => [], 'location_choices' => [], 'location_default' => null, 'location_favorites' => [], 'slot_default' => null, 'user' => true, 'user_choices' => [], 'user_default' => 1]);
//Set defaults
$resolver->setDefaults(['error_bubbling' => true, 'dance_choices' => [], 'dance_default' => null, 'dance_favorites' => [], 'location_choices' => [], 'location_default' => null, 'location_favorites' => [], 'slot_default' => null, 'user' => true, 'user_choices' => [], 'user_default' => 1]);
- public function getName() {
- return 'rapsys_air_application';
+ public function getName(): string {
+ return 'rapsysair_application';
- public function configureOptions(OptionsResolver $resolver) {
+ public function configureOptions(OptionsResolver $resolver): void {
//Set defaults
$resolver->setDefaults(['error_bubbling' => true]);
}
//Set defaults
$resolver->setDefaults(['error_bubbling' => true]);
}
- public function getName() {
+ public function getName(): string {
return 'contact_form';
}
}
return 'contact_form';
}
}
* {@inheritdoc}
*/
public function getName(): string {
* {@inheritdoc}
*/
public function getName(): string {
- return 'rapsys_air_image';
+ return 'rapsysair_image';
- public function buildForm(FormBuilderInterface $builder, array $options) {
- return $builder
+ public function buildForm(FormBuilderInterface $builder, array $options): void {
+ //Build form
+ $builder
->add('title', TextType::class, ['attr' => ['placeholder' => 'Your title'], 'constraints' => [new NotBlank(['message' => 'Please provide your title'])]])
->add('description', TextareaType::class, ['attr' => ['placeholder' => 'Your description', 'cols' => 50, 'rows' => 15], 'required' => false])
->add('address', TextType::class, ['attr' => ['placeholder' => 'Your address'], 'constraints' => [new NotBlank(['message' => 'Please provide your address'])]])
->add('title', TextType::class, ['attr' => ['placeholder' => 'Your title'], 'constraints' => [new NotBlank(['message' => 'Please provide your title'])]])
->add('description', TextareaType::class, ['attr' => ['placeholder' => 'Your description', 'cols' => 50, 'rows' => 15], 'required' => false])
->add('address', TextType::class, ['attr' => ['placeholder' => 'Your address'], 'constraints' => [new NotBlank(['message' => 'Please provide your address'])]])
- public function configureOptions(OptionsResolver $resolver) {
+ public function configureOptions(OptionsResolver $resolver): void {
$resolver->setDefaults(['data_class' => Location::class, 'error_bubbling' => true]);
}
}
$resolver->setDefaults(['data_class' => Location::class, 'error_bubbling' => true]);
}
}
* {@inheritdoc}
*/
public function getName(): string {
* {@inheritdoc}
*/
public function getName(): string {
- return 'rapsys_air_register';
+ return 'rapsysair_register';
- public function buildForm(FormBuilderInterface $builder, array $options) {
+ public function buildForm(FormBuilderInterface $builder, array $options): void {
//Is admin or user with rainfall >= 2
if (!empty($options['raincancel'])) {
//Add raincancel item
//Is admin or user with rainfall >= 2
if (!empty($options['raincancel'])) {
//Add raincancel item
->add('autoattribute', SubmitType::class, ['label' => 'Auto attribute', 'attr' => ['class' => 'submit']]);
}
}
->add('autoattribute', SubmitType::class, ['label' => 'Auto attribute', 'attr' => ['class' => 'submit']]);
}
}
-
- //Return form
- return $builder;
- public function configureOptions(OptionsResolver $resolver) {
+ public function configureOptions(OptionsResolver $resolver): void {
$resolver->setDefaults(['error_bubbling' => true, 'admin' => false, 'dance_choices' => [], 'dance_default' => null, 'dance_favorites' => [], 'date' => null, 'begin' => null, 'length' => null, 'cancel' => false, 'raincancel' => false, 'modify' => false, 'move' => false, 'attribute' => false, 'user' => null, 'session' => null, 'slot_default' => null]);
//Add admin
$resolver->setDefaults(['error_bubbling' => true, 'admin' => false, 'dance_choices' => [], 'dance_default' => null, 'dance_favorites' => [], 'date' => null, 'begin' => null, 'length' => null, 'cancel' => false, 'raincancel' => false, 'modify' => false, 'move' => false, 'attribute' => false, 'user' => null, 'session' => null, 'slot_default' => null]);
//Add admin
- public function getName() {
- return 'rapsys_air_session_edit';
+ public function getName(): string {
+ return 'rapsysair_session_edit';
* {@inheritdoc}
*/
public function getName(): string {
* {@inheritdoc}
*/
public function getName(): string {
- return 'rapsys_air_snippet';
+ return 'rapsysair_snippet';