Warnings and deprecations in SDC Styleguide Demo Components service

Created on 12 September 2024, 5 months ago
Updated 17 September 2024, 5 months ago

Problem/Motivation

The Styleguide Demo Components submodule generates several warnings and deprecations that need to be addressed.

Warning: Undefined array key "name" in Drupal\sdc_styleguide\Service\SDCDemoManager->getDemos() (line 83 of /var/www/html/web/modules/contrib/sdc_styleguide/src/Service/SDCDemoManager.php)

Deprecated function: strcmp(): Passing null to parameter #1 ($string1) of type string is deprecated in Drupal\sdc_styleguide\Service\SDCDemoManager->Drupal\sdc_styleguide\Service\{closure}() (line 129 of /var/www/html/web/modules/contrib/sdc_styleguide/src/Service/SDCDemoManager.php)

Deprecated function: strcmp(): Passing null to parameter #2 ($string2) of type string is deprecated in Drupal\sdc_styleguide\Service\SDCDemoManager->Drupal\sdc_styleguide\Service\{closure}() (line 129 of /var/www/html/web/modules/contrib/sdc_styleguide/src/Service/SDCDemoManager.php)

Steps to reproduce

* Drupal 10.3 Site running on PHP 8.3
* version 1.1.0-beta2 of sdc_styleguide
* Enable sdc_styleguide_demo_components
* Enable core dblog module
* Browse around the styleguide at /styleguide/explorer
* Check the DBLog report there are several reported issues, including stack dumps not included in this issue. The main error messages are included above.

πŸ› Bug report
Status

Postponed: needs info

Version

1.1

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States lhridley

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @lhridley
  • πŸ‡ΊπŸ‡ΈUnited States lhridley
  • πŸ‡ΊπŸ‡ΈUnited States lhridley
  • Status changed to Needs review 5 months ago
  • πŸ‡ΊπŸ‡ΈUnited States lhridley

    Patch is attached.

  • πŸ‡ΊπŸ‡ΈUnited States lhridley
  • Status changed to Postponed: needs info 5 months ago
  • πŸ‡¨πŸ‡·Costa Rica alemadlei
  • πŸ‡ΊπŸ‡ΈUnited States markie Albuquerque, NM

    This means the component.yml file is not properly populated.

    The issue I think is that SDC documentation says that the component.yml file content is all optional, so some folks just create the file and leave it blank (me.. I'm some folks). There should be checks in the form and demos generators to assure the arrays are populated. Of course, it would be better for developers to properly fill out the component.yml to spec.

  • πŸ‡ΊπŸ‡ΈUnited States markie Albuquerque, NM

    I did some updates to the forms since this was giving the errors as well. I think the checks for empty title and description in properties should be done since they are considered "optional" in the component.yml file.

    PS: Did the work in the issue branch first, then realized the MR wasn't against that branch, so did a local cherry pick and pushed to the proper branch.

  • πŸ‡ΊπŸ‡ΈUnited States markie Albuquerque, NM

    I made some more updates including pulling in the latest in the 1.1.x branch. I was able to verify this in Drupalpod by installing the sdc_styleguide_demo_components and removing the title and description from the card.component.yml file, clearing cache, and then reloading the styleguide. No notice or warnings appeared.

  • πŸ‡¨πŸ‡·Costa Rica alemadlei

    Hey @markie,

    There's a problem with pullign the code to 1.0.

    Drupal 10.3 got rid of the Drupal\sdc\ComponentPluginManager and instead prefers Drupal\Core\Theme\ComponentPluginManager.

    Pulling the code would break the drush generator.

  • πŸ‡ΊπŸ‡ΈUnited States markie Albuquerque, NM

    I am not seeing anything in this MR that changes the `Drupal\sdc\ComponentPluginManager`... I that something that changed from the 1.0.x branch and the 1.1.x branch? This MR should be able to be cherry picked to the 1.0.x branch without changing the plugin.

  • πŸ‡¨πŸ‡·Costa Rica alemadlei

    This is strange.

    https://git.drupalcode.org/project/sdc_styleguide/-/merge_requests/7/dif...

    I see that it is changing the code in the generator at src/Drush/Generators/SDCStyleguideDemoGenerator.php

  • πŸ‡ΊπŸ‡ΈUnited States markie Albuquerque, NM

    Oh weird.. This must be because of my branch issues.. I think I'll close the MR, and create a new one in the issue branch... will do that tomorrow or so..

Production build 0.71.5 2024