Form element alignment not working as expected
Hi there,
just wondering, how to get the fields aligned like EasyAdmin does. Created a form to enter a new password. It's a non-entity form extending the @EasyAdmin/default/layout.html.twig template.
It's looking that way:

{% extends '@EasyAdmin/default/layout.html.twig' %}
{% block content_title %}
{% spaceless %}
Set Password for User xxx
{% endspaceless %}
{% endblock %}
{% block main %}
{{ form(form) }}
{% endblock %}
<?php
namespace App\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface;
class NewPasswordType extends AbstractType
{
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add(
'password',
RepeatedType::class,
[
'first_options' => ['label' => 'Password'],
'second_options' => ['label' => 'Repeat password'],
'type' => PasswordType::class,
]
)
->add('submit', SubmitType::class, ['label' => 'Save password']);
}
}
public function setPasswordAction()
{
$id = $this->request->query->get('id');
$user = $this->em->getRepository(User::class)->find($id);
$form = $this->createForm(NewPasswordType::class);
$form->handleRequest($this->request);
if ($form->isSubmitted() && $form->isValid()) {
$plainPassword = $form->get('password')->getData();
$password = $this->encoder->encodePassword($user, $plainPassword);
$user->setPassword($password);
$this->entityManager->flush();
return $this->redirectToRoute(
'easyadmin',
array(
'action' => 'list',
'entity' => $this->request->query->get('entity'),
)
);
}
return $this->render('security/set-password.html.twig', ['form' => $form->createView()]);
}
How can I get it aligned like the usual EasyAdmin forms are?

Any help is appreciated.
Regards Markus
I'm not an expert in Symfony Forms ... but maybe this is fixed if you set the following at the beginning of your Twig template:
{% form_theme form with easyadmin_config('design.form_theme') %}
I‘ll give it a try. Thanks!
@javiereguiluz I had a similar issue, did it your way and got 'Variable easyadmin not found' error. Solved with a way around creating a "Virtual Entity".
I'm closing this old issue as hopefully fixed. Thanks.