. */ declare(strict_types=1); namespace App\Form\AdminPages; use App\Entity\Base\AbstractNamedDBElement; use App\Entity\Parts\MeasurementUnit; use App\Form\Type\StructuralEntityType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\FormBuilderInterface; class StorelocationAdminForm extends BaseEntityAdminForm { protected function additionalFormElements(FormBuilderInterface $builder, array $options, AbstractNamedDBElement $entity): void { $is_new = null === $entity->getID(); $builder->add('is_full', CheckboxType::class, [ 'required' => false, 'label' => 'storelocation.edit.is_full.label', 'help' => 'storelocation.edit.is_full.help', 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'move', $entity), ]); $builder->add('limit_to_existing_parts', CheckboxType::class, [ 'required' => false, 'label' => 'storelocation.limit_to_existing.label', 'help' => 'storelocation.limit_to_existing.help', 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'move', $entity), ]); $builder->add('only_single_part', CheckboxType::class, [ 'required' => false, 'label' => 'storelocation.only_single_part.label', 'help' => 'storelocation.only_single_part.help', 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'move', $entity), ]); $builder->add('storage_type', StructuralEntityType::class, [ 'required' => false, 'label' => 'storelocation.storage_type.label', 'help' => 'storelocation.storage_type.help', 'class' => MeasurementUnit::class, 'disable_not_selectable' => true, 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'move', $entity), ]); } }