Problem/Motivation

Installing the recipe logs 477 PHP warnings:

ddev drush si -y ../recipes/horizonaid

 [warning] Undefined array key "" Component.php:231            x159
 [warning] Trying to access array offset on null Component.php:231   x318

Component.php:231 is Drupal\canvas\Entity\Component::sourcePluginCollection(), in the arm it takes when a Component's active version is the special fallback version:

'slots' => \array_key_exists('last_active_version', $this->getSettings())
  ? $this->versioned_properties[$this->getSettings()['last_active_version']]['fallback_metadata']['slot_definitions']
  : [],

Nineteen files in config/ ship exactly that state, with an EMPTY version string as the key:

langcode: en
status: false
dependencies: {  }
active_version: fallback
versioned_properties:
  active:
    settings:
      last_active_version: ''
label: Details
id: sdc.vartheme_bs5_horizonaid.details
provider: vartheme_bs5_horizonaid
source: sdc
source_local_id: 'vartheme_bs5_horizonaid:details'

So the lookup is $this->versioned_properties[''] - an undefined array key, yielding NULL, followed by two array offsets on that NULL. Three warnings per evaluation, and each Component is evaluated twice while the recipe's config is installed: 19 x 2 x 3 = 114, plus the same components re-saved during dependency calculation, for 477 in one install.

Two separate defects produced those files:

1. Eighteen of them should never have existed. details, field, fieldset, form, form-element, form-element-radiocheckbox, input-checkbox, input-submit, links-dropbutton, list, local-tasks, page, page-footer, radios, region, select, social-auth and user are theme-internal SDCs. Sixteen carry noUi: true in the theme, so SingleDirectoryComponentDiscovery::discover() filters them out and Canvas never creates a Component config entity for them at all. The recipe creates them itself, in a broken state, purely so that its own eighteen disable: [] config actions have something to act on. (input-checkbox and input-submit are the two that are not flagged in the theme - that is #3621846.)

2. The nineteenth, taxonomy, is genuinely used and is broken on every site. The recipe's own Canvas trees place it:

component_id: sdc.vartheme_bs5_horizonaid.taxonomy
component_version: 3351b78763f50152

but config/canvas.component.sdc.vartheme_bs5_horizonaid.taxonomy.yml ships it as status: false with active_version: fallback and no 3351b78763f50152 version at all. Every place that badge appears - the event cards, for one - renders through Canvas's fallback component instead of the taxonomy badge.

Steps to reproduce

mkdir -p my-drupal-site-horizonaid
cd my-drupal-site-horizonaid
ddev config --project-type=drupal11 --docroot=web
ddev composer create-project drupal/cms
ddev composer require drupal/horizonaid
ddev drush si -y ../recipes/horizonaid

Count the warnings, and afterwards confirm the Components are still in the fallback state:

ddev drush php:eval '
foreach (\Drupal::configFactory()->listAll("canvas.component.") as $n) {
  if ((\Drupal::config($n)->get("active_version") ?? "") === "fallback") echo $n . "\n";
}'

Proposed resolution

  • Delete the eighteen theme-internal Component config files from config/, and the eighteen matching disable: [] config actions from recipe.yml. Canvas ignores those SDCs, so there is nothing to create and nothing to disable.
  • Replace config/canvas.component.sdc.vartheme_bs5_horizonaid.taxonomy.yml with a real export of the component: status: true, active_version: 3351b78763f50152 (the version the recipe's own trees already name), its prop_field_definitions, and its real dependencies on link, options and the theme.

Verified on a clean build of Drupal CMS 2.1.4 + Horizon Aid: the install goes from 477 warnings to zero, no Component is left in the fallback state, and canvas.component.sdc.vartheme_bs5_horizonaid.taxonomy installs enabled at 3351b78763f50152.

Remaining tasks

  • ✅ File an issue
  • ✅ Addition/Change/Update/Fix
  • ✅ Testing to ensure no regression
  • ➖ Automated unit/functional testing coverage
  • ➖ Developer Documentation support
  • ➖ User Guide Documentation support
  • ➖ 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

User interface changes

  • The taxonomy badge renders as itself instead of as Canvas's fallback component wherever the recipe places it.

API changes

  • N/A

Data model changes

  • Eighteen canvas.component.sdc.vartheme_bs5_horizonaid.* config entities are no longer created by the recipe. They were disabled and unusable, and nothing depends on them.

Release notes snippet

  • Installing Horizon Aid no longer logs 477 PHP warnings, and the taxonomy badge component installs enabled instead of in Canvas's fallback state.

Issue fork horizonaid-3621847

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

rajab natshah created an issue.

  • rajab natshah committed 4e42cf29 on 1.0.x
    fix: #3621847 Remove the nineteen Canvas Component config entities...