mirror of
				https://gitlab.com/Chill-Projet/chill-bundles.git
				synced 2025-11-03 18:58:24 +00:00 
			
		
		
		
	stored object: add has_title option to form type of StoredObject
This commit is contained in:
		@@ -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()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user