Reputation: 11
I'm trying to create a form with 3 submit buttons and I want to put them horizontally at the bottom of the form.
I created my form:
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('title', CKEditorType::class, [
'label'=>'Title'
])
->add('content', CKEditorType::class, [
'label'=>'Content'
])
->add('save', SubmitType::class, [
'label' => 'Save'
])
->add('saveAndQuit', SubmitType::class, [
'label' => 'Save and quit'
])
->add('quit', SubmitType::class, [
'label' => 'Quit'
]);
}
The three buttons are aligned vertically.
How I could align them horizontally ?
Upvotes: 1
Views: 611
Reputation: 21
To align the buttons you can try the 'attr' attribute when building your form.
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('title', CKEditorType::class, [
'label'=>'Title',
'attr' => ['class' => 'your_class']
])
}
Then you can add the css properties to that class.
Upvotes: 1