Problem/Motivation

The Content Access Simple module attempted to use the disableCheckboxes method from the ContentAccessRoleBasedFormTrait as a static callback in the Form API #process property.

This caused a fatal error:
TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, non-static method Drupal\content_access\Form\ContentAccessRoleBasedFormTrait::disableCheckboxes() cannot be called statically
As a result, forms using Content Access Simple failed to render, breaking node editing and related functionality.

This is because recent changes in content_access 2.1.0-rc3 prevent this from being called statically.

Steps to reproduce

  1. Enable Content Access (2.1.0-rc3) and Content Access Simple modules.
  2. Attempt to edit a node with Content Access Simple enabled.
  3. Observe the fatal error and broken form.

Proposed resolution

  • Refactor Content Access Simple to use the trait ContentAccessRoleBasedFormTrait in its AccessManager class.
  • Register the disableCheckboxes callback as [$this, 'disableCheckboxes'] from within an instance method, ensuring it is called in the correct object context.
  • This allows the checkboxes to be properly disabled without causing a fatal error.
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

joegl created an issue. See original summary.

joegl’s picture

This is not gonna work; it causes serialization issues because the process callback should be static. Will look towards another solution, possibly even getting changes made in content_access.

See: #3570550

joegl’s picture

This was resolved upstream in content_access (for now). Either way, this was not the correct solution and the issue was caused by an anti-pattern being introduced in content_access. Going to close this.

joegl’s picture

Status: Active » Closed (won't fix)

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

joegl’s picture

Content Access related issue: https://www.drupal.org/project/content_access/issues/3570550
Merge request: https://git.drupalcode.org/project/content_access/-/merge_requests/30
This was already cut into the rc4 release so don't need to patch from merge request.