/** * @param FormBuilderInterface $builder * @param array $options */ public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('message', TextareaType::class, ['label' => 'ticket.label.form.message', 'attr' => ['placeholder' => 'ticket.placeholder.form.message'], 'required' => false])->add('media', FileMediaType::class, ['provider' => 'sonata.media.provider.ticket_image', 'context' => 'ticket', 'label' => 'ticket.label.form.image', 'translation_domain' => 'messages', 'required' => false])->add('priority', ChoiceType::class, ['label' => 'ticket.label.form.priority', 'choices' => Message::getPriorities()]); // if existing ticket add status if (!$this->isNewTicket) { $builder->add('closeTicket', SubmitType::class, ['label' => 'ticket.button.close_ticket', 'translation_domain' => 'messages', 'attr' => ['value' => 'closeTicket', 'class' => 'btn btn-danger'], 'validation_groups' => false])->add('changePriority', SubmitType::class, ['label' => 'ticket.button.change.priority', 'validation_groups' => false, 'attr' => ['value' => 'changePriority', 'class' => 'btn btn-warning']])->add('submit', SubmitType::class, ['label' => 'ticket.button.reply', 'attr' => ['class' => 'btn btn-primary']]); } }
/** * @param DatagridMapper $datagridMapper */ protected function configureDatagridFilters(DatagridMapper $datagridMapper) { $datagridMapper->add('id')->add('lastMessageAt')->add('subject')->add('status', null, [], 'choice', ['choices' => Message::getStatuses('ticket.status_')])->add('priority', null, [], 'choice', ['choices' => Message::getPriorities()])->add('createdAt')->add('isRead'); }
/** * @param FormMapper $formMapper */ protected function configureFormFields(FormMapper $formMapper) { $formMapper->add('message', TextareaType::class, ['required' => false])->add('status', 'choice', ['choices' => Message::getStatuses('ticket.status_')])->add('priority', 'choice', ['choices' => Message::getPriorities()])->add('media', FileMediaType::class, ['provider' => 'sonata.media.provider.ticket_image', 'context' => 'ticket', 'required' => false]); }