Repository navigation
refactor!: render the form buttons via overridable views - #6791
Merged
Merged
Conversation
The submit buttons, the cancel link and the toolbar wrapping them are rendered by the new widgets `Button`, `CancelLink` and `ButtonToolbar` with their own views instead of markup hard-coded in `Form`, so they can be restyled like the other form views (e.g. for the frontend via `ViewResolver::overrideNamespace()`). - `SubmitButton::$class` is replaced by the semantic `SubmitButton::$style` (`ButtonStyle::Primary`/`Secondary`/ `Danger`); the backend view maps it to the css classes. - `Form::buttons()` renders the whole toolbar including the `btn-toolbar` wrapper; the backend view aligns the first button with the field column. - `Form::button()` takes html attributes instead of the `aligned` flag. - `Accesskey::get()` returns the accesskey for a key.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #6787: the form buttons were the last part of the form system with markup hard-coded in
Form(btn …classes, accesskeys,rex-form-aligned), so they couldn't be restyled for the frontend.Button,CancelLinkandButtonToolbar, each with its own view. Since they live underRedaxo\Core\Form,ViewResolver::overrideNamespace('Redaxo\Core\Form', …)covers them as well.SubmitButton::$class(a Bootstrap class) →SubmitButton::$stylewith the newButtonStyleenum (Primary,Secondary,Danger). The backend view maps it tobtn-save/btn-default/btn-delete; the button namedapplykeepsbtn-apply, becausestandard.jsclicks that one on cmd+enter.Form::buttons()now renders the whole toolbar including thebtn-toolbarwrapper, and its backend view aligns the first button.Form::button()takes html attributes instead of thealignedflag (custom markup passes['class' => ['rex-form-aligned']]).accesskeystays on the button: it states the button's intent, the backend view turns it into the actual key (newAccesskey::get()), other views can ignore it.Breaking:
SubmitButton(class: …)→style: ButtonStyle::…,Form::button($name, aligned: true)→ attributes, and callers no longer wrapForm::buttons()in.btn-toolbar.