Problem/Motivation

The conflict module is throwing a fatal error when the workspace activation form is processed. The error occurs because conflict_prepare_entity_form() attempts to call getFormDisplay() on Drupal\workspaces\Form\WorkspaceActivateForm, which doesn't implement ContentEntityFormInterface and therefore doesn't have this method.

The code at line 177-179 includes an instanceof check to prevent this scenario, but the error is still occurring, suggesting either:

  • The check is not working as expected in certain conditions
  • There's a caching issue that causes older code to execute
  • The line numbers in the error trace don't match the actual execution path

Error message:

Error: Call to undefined method Drupal\workspaces\Form\WorkspaceActivateForm::getFormDisplay() 
in conflict_prepare_entity_form() (line 177 of modules/contrib/conflict/conflict.module)

Steps to reproduce

  1. Install and enable the conflict module (version 3.0.0-beta2)
  2. Install and enable the workspaces module
  3. Navigate to the workspace activation form (typically at /admin/content/workspace/[workspace_id]/activate)
  4. Observe the fatal error

Proposed resolution

Verify that the instanceof check is functioning correctly and covers all edge cases. Possible solutions:

  1. Add early return in hook_form_alter: Check if the form object implements ContentEntityFormInterface before calling conflict_prepare_entity_form()
  2. Strengthen the check: Ensure the instanceof check on line 178 is properly evaluated before the getFormDisplay() call
  3. Add method_exists check: Use method_exists() as an additional safety check before calling getFormDisplay()
  4. Clear documentation: Document that cache clearing is required after updating the module

Remaining tasks

  • Confirm the bug with maintainers
  • Identify the root cause (why the instanceof check isn't preventing the call)
  • Develop and test a patch
  • Review and commit the fix
  • Update documentation if cache-related

User interface changes

None. This fix prevents a fatal error but doesn't change any user-facing interfaces.

API changes

None. The fix should maintain backward compatibility while preventing the error.

Data model changes

None.

CommentFileSizeAuthor
#2 conflict-3565623-1.patch929 bytesbala_28

Comments

bala_28 created an issue. See original summary.

bala_28’s picture

StatusFileSize
new929 bytes

I have added a patch here.