We have *a lot* of duplicated, almost identical code in our delete confirmation forms. Every entity needs to copy that and make small adjustments, we also have small differences between them, some log messages, some don't, many have slightly different strings.
Add default delete forms for config and content entities, with a trait to share the code (they have different parent classes). Allow to override the deletion confirmation message and the log behavior, but do log by default.
Use that for all entity types in core, as far as possible. In some cases, I accepted the new messages and updated tests a bit, in others I added overrides. Quite a few delete forms can be removed completely.
For language deletions, two additional changes were made, access check to avoid deleting the default language is now done in the access control handler, which removes the need for a custom check in the form. Previously, that then did a redirect, now it is simply an access denied page. Updated the tests for that. Also removed a bogus check if the language really exists after it was already loaded.
User interface changes
New classes that can be used by default or with small overrides. Usage is completely optional, no existing API is changed.
Beta phase evaluation
|Issue category||Task because we can save 700 lines of stupid code and improve DX for defining entities|
|Issue priority||Currently on normal, but could probably be major?|
|Disruption||None, usage is completely optional.|
Original report by @plach
EntityDefaultFormController and a
EntityDeleteFormController which would both extend a basic
|PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 84,955 pass(es).|
|FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] Unable to apply patch entity-delete-forms-1728804-47.patch. Unable to apply patch. See the log in the details link for more information.|
|PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 84,505 pass(es).|