Assertion for entity.form_builder service is incorrect

Created on 26 March 2025, 9 days ago

Problem/Motivation

workflow_buttons.module's workflow_buttons_entity_view() has an assertion for \Drupal::service('entity.form_builder'); to be an instance of Drupal\Core\Form\FormBuilder, but that service instead returns an instance of Drupal\Core\Entity\EntityFormBuilder, causing an error.

Steps to reproduce

Upgrade to the latest dev release and try visiting a page that calls workflow_buttons_entity_view(). Page load will fail with error:

AssertionError: assert($form_builder instanceof FormBuilder) in assert() (line 117 of /var/www/html/docroot/sites/default/modules/contrib/workflow_buttons/workflow_buttons.module).

Proposed resolution

Update the assertion to instead expect an instance of Drupal\Core\Entity\EntityFormBuilderInterface.

See also πŸ“Œ Automated Drupal 11 compatibility fixes for workflow_buttons Active MR #13 which considers this new to Drupal 11, though it is present in Drupal 10 as well. Propose making the same changes as in this commit, but separate from Drupal 11 readiness topic.

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

None.

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States daletrexel Minnesota, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024