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 #3451409: Automated Drupal 11 compatibility fixes for workflow_buttons 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.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

daletrexel created an issue. See original summary.

daletrexel’s picture

Please also credit @ultrabob for also proposing this change in #3451409: Automated Drupal 11 compatibility fixes for workflow_buttons, although the problem exists in Drupal 10 with the latest dev release of this module.

alexdmccabe’s picture

mlncn credited ultrabob.

mlncn’s picture

Status: Active » Fixed

Yes it was! And then in #3523277: Clean up any remaining code issues for a Drupal 11 Release the @var line with a missing asterisk was removed, and i think is redundant with the assertion in most IDEs.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.