fix: #3609084 Guard Access Unpublished class reference during install

Fixes #3609084: https://www.drupal.org/project/varbase_workflow/issues/3609084

A fresh Varbase "full" install fatals during varbase_workflow install:

Error: Class "Drupal\access_unpublished\AccessUnpublished" not found in varbase_workflow__grant_access_unpublished_permissions() (line 49 of includes/helpers.inc)

access_unpublished is listed under the soft install: key, and includes/helpers.inc calls AccessUnpublished::applicableEntityType() with no guard. When varbase_workflow's own hook_install() runs before access_unpublished's classes are autoloadable, the whole site install aborts.

This MR applies both fixes suggested in the issue:

  • Move access_unpublished from install: to dependencies: in varbase_workflow.info.yml, so Drupal's dependency resolver guarantees it is fully enabled before varbase_workflow's install hooks run.
  • Guard the AccessUnpublished::applicableEntityType() call in varbase_workflow__grant_access_unpublished_permissions() with \Drupal::moduleHandler()->moduleExists('access_unpublished'), so the code is defensive even if load order changes again.

Only the 3.1.x branch is affected — 2.2.x does not list access_unpublished in install: and its includes/helpers.inc has no such reference.

Verified locally: rebuilt a Varbase 10.1.x site in DDEV with this fix branch aliased in via composer, ran drush site:install, and confirmed the front page returns 200 (previously a 500 fatal).

AI-Generated: Yes (Used Claude Code to diagnose, fix and verify this issue)

Checkpoints

  • File an issue about this project
  • Addition/Change/Update/Fix to this project
  • Testing to ensure no regression
  • Automated unit/functional testing coverage
  • Developer Documentation support on feature change/addition
  • User Guide Documentation support on feature change/addition
  • UX/UI designer responsibilities
  • Accessibility and Readability
  • Reviewed by a human
  • Code review by maintainers
  • Full testing and approval
  • Credit contributors
  • Review with the product owner
  • Update Release Notes
  • Release
Edited by Rajab Natshah

Merge request reports

Loading
Loading