Repository navigation
Release v2.18.0
Changelog
POST actions without a raw <form> (REQ-TWIG-005)
Changed
- Actions (
partials/_action_post.html.twig): a POSTView\Actionthat carries acsrfTokeninstead of a
formno longer renders a hand-written<form>/<input>. UiKit builds a nameless CSRF-only form for it
(Form\ActionCsrfType: one hidden field namedcsrfField, default_token, holding the token; the form's own CSRF
protection is off, so there is no second token) and renders it throughform_start/form_end
(_action_form_view), like an action with aform. The request is unchanged: same URL,method="post", same
_token(or customcsrfField) name and value,_methodfor PUT / PATCH / DELETE, same button markup, classes,
data-*/disabledattributes,class="nowo-ui-action__form"andid(type-to-confirm). Only the order inside
the form differs: the token now follows the button and_methodis printed byform_start(<input … />). Used by
toolbar actions, row actions, the confirm dialog and thepage/confirmscaffold.
Added
nowo_ui_action_form(action)(Twig,ThemeExtension): theFormViewa POST action renders — itsform, else the
CSRF-only form of itscsrfToken; null for GET actions.Form\ActionCsrfType(CSRF-only Form Type,ActionCsrfType::createActionView()), built on a standalone form
factory (core types only: host type extensions do not change the action forms), service
nowo_ui_kit.action_form_factory(registered only with symfony/form).
Deprecated
- The raw
<form>fallback (partials/_action_post_legacy.html.twig) for a POST action without aformwhen
symfony/form or its Twig extension (form_start) is missing, or whencsrfFieldis not a valid form field name
(for exampletoken[x]). It triggers a deprecation and will be removed in 3.0: install symfony/form, or pass a
CSRF-onlyFormViewasAction::$form.