Convert HelpSection plugin discovery to attributes

Created on 13 February 2024, 7 months ago
Updated 16 March 2024, 6 months ago

Problem/Motivation

In πŸ“Œ Use PHP attributes instead of doctrine annotations Fixed we added support for attribute based plugin discovery.
As part of that issue we converted block and action plugins.

This issue is to convert \Drupal\help\Annotation\HelpSectionplugins to use Attributes.

Proposed resolution

  1. Add a class to represent the new Attribute - Example
  2. Update the plugin manager constructor to include both the attribute and annotation class names - example
  3. Convert all plugins that use the annotation to use the new attribute - example

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Fixed

Version

10.3 ✨

Component
HelpΒ  β†’

Last updated 5 days ago

No maintainer
Created by

πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

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

Merge Requests

Comments & Activities

  • Issue created by @larowlan
  • πŸ‡ΊπŸ‡ΈUnited States Amber Himes Matz Portland, OR USA

    Amber Himes Matz β†’ made their first commit to this issue’s fork.

  • Assigned to Amber Himes Matz
  • πŸ‡ΊπŸ‡ΈUnited States Amber Himes Matz Portland, OR USA
  • Issue was unassigned.
  • Status changed to Needs review 7 months ago
  • πŸ‡ΊπŸ‡ΈUnited States Amber Himes Matz Portland, OR USA

    I took a stab at this.

  • Pipeline finished with Failed
    7 months ago
    Total: 280s
    #94482
  • Status changed to Needs work 7 months ago
  • πŸ‡ΊπŸ‡ΈUnited States Amber Himes Matz Portland, OR USA

    Looks like I missed some coding standards. I'll take a closer look tomorrow if I can. Happy to have help though.

  • Pipeline finished with Failed
    7 months ago
    Total: 187s
    #94484
  • Assigned to Amber Himes Matz
  • πŸ‡ΊπŸ‡ΈUnited States Amber Himes Matz Portland, OR USA
  • Issue was unassigned.
  • Status changed to Needs review 7 months ago
  • πŸ‡ΊπŸ‡ΈUnited States Amber Himes Matz Portland, OR USA

    Thanks for the review, @larowlan! I think I addressed everything, though there was 1 point of confusion about line 29 of core/modules/help/src/Plugin/HelpSection/HelpTopicSection.php, which I asked about in GitLab.

  • Pipeline finished with Failed
    7 months ago
    #94503
  • Pipeline finished with Failed
    7 months ago
    Total: 182s
    #94526
  • Status changed to Needs work 7 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Appears to have some failures.

  • First commit to issue fork.
  • Pipeline finished with Failed
    7 months ago
    Total: 184s
    #94985
  • Assigned to Amber Himes Matz
  • πŸ‡ΊπŸ‡ΈUnited States Amber Himes Matz Portland, OR USA

    I'm working on this again. When I try to install Drupal 11.x-dev with this code running, the installation is failing with a typehint error in this new code.

    TypeError: Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery::__construct(): Argument #4 ($annotation_namespaces) must be of type array, string given, called in /var/www/html/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php on line 305 in Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery->__construct() (line 56 of core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php).

    After fixing this, I will test the HelpSection in the UI to make sure it's working and upload a screenshot of that.

  • Pipeline finished with Success
    7 months ago
    Total: 468s
    #95326
  • Issue was unassigned.
  • Status changed to Needs review 7 months ago
  • πŸ‡ΊπŸ‡ΈUnited States Amber Himes Matz Portland, OR USA

    There was a missing use statement for the HelpSection attribute class in HelpSectionManager.php. Adding this fixed the error on installation (because it fixed the value of the HelpSection::class parameter passed in the parent constructor, which was meaningless without the use Drupal\help\Attribute\HelpSection; statement.

    I tested this on a successfully-installed 11.x-dev site and verified that HelpSection plugins displayed as expected on admin/help. Screenshot attached with HelpSection plugins provided by Help module highlighted.

  • πŸ‡³πŸ‡ΏNew Zealand quietone New Zealand

    I glanced at MR and see that the test HelpSection plugins still need to be converted.

  • Assigned to Amber Himes Matz
  • Status changed to Needs work 7 months ago
  • πŸ‡ΊπŸ‡ΈUnited States Amber Himes Matz Portland, OR USA

    Thanks @quietone for the reminder! I am working on this now.

    Also, I updated the IS with remaining tasks (and those already done).

  • Issue was unassigned.
  • Status changed to Needs review 7 months ago
  • πŸ‡ΊπŸ‡ΈUnited States Amber Himes Matz Portland, OR USA

    This is ready for review.

    I've converted the 2 test plugins, EmptyHelpSection and TestHelpSection to use the HelpSection attribute.

    And I removed a trailing comma from the last item in the attribute HelpTopicSection. I guess we're not doing trailing commas for last items in these arrays in attributes? Yet, anyway. I think that code standards for these are still pending (that's my current understanding). Regardless, this makes everything consistent and is consistent with the Action example as well.

  • πŸ‡ΊπŸ‡ΈUnited States Amber Himes Matz Portland, OR USA

    Updated remaining tasks in issue summary (all tasks done).

  • Pipeline finished with Success
    7 months ago
    Total: 555s
    #96076
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    See that all @HelpSection have been replaced and tests appear to be passing.

    Applying locally I can still use help module just fine

    +1 from me but will leave in review for additional eyes.

  • Status changed to RTBC 7 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Re-reviewed and appears all feedback has been addressed.

  • First commit to issue fork.
  • Pipeline finished with Canceled
    6 months ago
    Total: 89s
    #107112
  • Pipeline finished with Canceled
    6 months ago
    Total: 126s
    #107116
  • πŸ‡«πŸ‡·France andypost

    +1 RTBC, just added declare(strict_types=1); to new class and rebased

  • Pipeline finished with Success
    6 months ago
    Total: 483s
    #107117
  • Status changed to Needs work 6 months ago
  • πŸ‡¬πŸ‡§United Kingdom catch

    This is missing deriver support per πŸ“Œ Add an assert that ensures all attribute plugins support derivers Needs review

  • Pipeline finished with Canceled
    6 months ago
    Total: 27s
    #108268
  • Status changed to Needs review 6 months ago
  • πŸ‡«πŸ‡·France andypost

    Fixed #21

  • Pipeline finished with Failed
    6 months ago
    Total: 177s
    #108270
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    @andypost mind taking a look at the phpcs error? Can review after.

  • πŸ‡«πŸ‡·France andypost

    Fixed, sorry

  • Pipeline finished with Success
    6 months ago
    Total: 680s
    #108298
  • Status changed to RTBC 6 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Still blows my mind you can make that change and few minutes later tests are done.

    Feedback has been addressed.

    Thanks!

  • πŸ‡ΊπŸ‡ΈUnited States Amber Himes Matz Portland, OR USA

    Updated issue summary’s remaining tasks about adding the optional deriver argument, and crossed it off to show that we’ve completed it.

  • πŸ‡ΊπŸ‡ΈUnited States Amber Himes Matz Portland, OR USA

    I went through all unresolved threads and double-checked that they were resolved, and resolved them.

  • Status changed to Fixed 6 months ago
  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    Committed and pushed b9dfd470e3 to 11.x and c57ce025c3 to 10.3.x. Thanks!

    • alexpott β†’ committed c57ce025 on 10.3.x
      Issue #3420993 by Amber Himes Matz, andypost, sakthi_dev, smustgrave,...
    • alexpott β†’ committed b9dfd470 on 11.x
      Issue #3420993 by Amber Himes Matz, andypost, sakthi_dev, smustgrave,...
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024