Skip to content

Conversation

@rdohms
Copy link
Contributor

@rdohms rdohms commented Feb 5, 2014

This adds support for printing all buttons in a single row, as bootstrap expects them to be (as mentioned in #114).

screen shot 2014-02-05 at 18 09 30

The syntax used on the form objects is:

  ->add('buttons', 'form_actions', [
      'buttons' => [
          'save' => ['type' => 'submit', 'options' => ['label' => 'button.save']],
          'cancel' => ['type' => 'button', 'options' => ['label' => 'button.cancel']],
      ]
  ]);

Caveat:
Bootstrap relies on the presence of whitespace between buttons to show them with proper spacing. Since most of the form stuff in symfony is encapsulated by spaceless at one point or another, the only way to ensure space between buttons is by using a  . Which i did in the template.
Another possible solution is to add a custom style that adds the margin, but this breaks the "don't touch bootstrap" way of things and adds custom CSS, probably not a good idea.
I'll let @florianeckerstorfer weigh in on this.

To Do:

  • Add Custom Type for Button Groups
  • Add proper rendering blocks and handle proper off-setting
  • Add constraint to only allow buttons in the group
  • Tests?
  • Brush off code with phpdocs and etc.

This add s button group which accepts multiple buttons and prints them as bootstrap expects them.
More improvements, tests and cleaning up are needed.

Also there is an issue with whitespace, since bootstrap relies on it to add space between buttons, used a nbsp for now.
- added tests
- added check for only accepting buttons
@rdohms
Copy link
Contributor Author

rdohms commented Feb 17, 2014

Any input on this? does something need changing or can we merge it in?

florianeckerstorfer pushed a commit that referenced this pull request Feb 17, 2014
Support for Form Actions (grouped buttons)
@florianeckerstorfer florianeckerstorfer merged commit c108ff9 into braincrafted:develop Feb 17, 2014
@florianeckerstorfer
Copy link
Member

Thanks for pinging me, I completely forget about it. Thanks for the PR.

@bendavies
Copy link

@rdohms do you think you could update the docs too?
https://github.com/braincrafted/bootstrap.braincrafted.com

@rdohms
Copy link
Contributor Author

rdohms commented Feb 17, 2014

I was looking for the docs, was waiting for the final word. I'll see to update the docs soon as a slot opens up.

@rdohms
Copy link
Contributor Author

rdohms commented Feb 18, 2014

I seem to have found a problem with the current implementation. It can trigger the FormValidator to trigger "extra fields found" error, currently look at how we can solve that.

@rdohms rdohms mentioned this pull request Feb 18, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants