Problem/Motivation

Layout Builder's "Discard changes" button (LayoutBuilderEntityFormTrait::actions()) and "Revert to defaults" button (OverridesEntityForm::actions()) both throw away layout changes, but they're submit buttons with no #button_type, so themes style them like any other button. Core marks its other destructive actions as danger, such as the Delete link in EntityForm::actions() (button--danger).

Proposed resolution

Set '#button_type' => 'danger' on both buttons, so Button::preRenderButton() adds button--danger and themes can style them as destructive.

Remaining tasks

  • Add the button type and a test.
  • Screenshots in Claro and Olivero.

AI disclosure

Generated with the help of an LLM. Claude Code found the missing button types while reviewing a theme change on a site I work on, checked core's code, and drafted this issue; I confirmed the behavior and edited the text.

Comments

dave reid created an issue.