Why my Save and Preview buttons are always in the middle of form?
See attachment.
It's quite annoying.
How I can move them to the end?

CommentFileSizeAuthor
Clipboard01.jpg55.56 KBkenorb

Comments

ainigma32’s picture

Status: Active » Postponed (maintainer needs more info)

Yes that does look annoying ;-)

I would have to guess but it's probably a module that is messing with the weights of the different form elements.
See here http://api.drupal.org/api/file/developer/topics/forms_api_reference.html... for the API docs on the weight of form items.

You could use a hook_form_alter to set the weight of the buttons really high so the will 'sink' to the bottom.

Please post back how that works out for you.

- Arie

ainigma32’s picture

Status: Postponed (maintainer needs more info) » Fixed

Looks like kenorb won't be posting any feedback so I'm setting this to fixed.

Feel free to reopen if you think that is wrong.

- Arie

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

kenorb’s picture

Status: Closed (fixed) » Active

It always take me couple of weeks to get back to some issue:)
I'm not sure that changing weight of all field elements each time in form_alter is a not good solution.
Eventually it can be done only for Preview and Save and change it to last position.
I think there should be some solution to make it permanently.
Maybe there is some module, that do it?

dave reid’s picture

Create a small custom module that uses hook_form_alter to run this line:
$form['buttons']['#weight'] = 100;

You don't need to adjust the weights of all the fieldsets. Just make the buttons heavier.

kenorb’s picture

Ok, that looks better.
I'll try this fix, but after some time when I'll back to it.

Maybe this high weight for buttons should be as standard in Drupal?

dpearcefl’s picture

If this is a feature request, it will need to be made against D8.

mdupont’s picture

Status: Active » Closed (works as designed)

Old issue. Closing. It is contrib modules' responsibility to ensure buttons are correctly displayed when they alter forms.