Implement object oriented hooks

Created on 20 October 2024, 9 months ago

Problem/Motivation

See Change Record β†’ for details.

πŸ“Œ Task
Status

Active

Version

2.1

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

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

Merge Requests

Comments & Activities

  • Issue created by @jurgenhaas
  • πŸ‡ΊπŸ‡ΈUnited States michaellander

    Worth noting, we found an issue with eca_config_schema_info_alter() not firing when the eca_config module was enabled. I was able to work around this by using an OOP hook.

    See πŸ“Œ Config validation for ECA models Active

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    Thanks @michaellander for the additional info. I think, though, that we will not switch to OOP hooks with ECA 2.1 because that version also supports Drupal 10.3 and then things would be broken. We will wait for ECA 3.x which will eventually support ^11.4 || ^12 of Drupal core. Note: 11.4 as the lowest version I've just made up, it's not clear yet which 11 release will be the one that won't see too many breaking changes before Drupal 12.

  • First commit to issue fork.
  • πŸ‡ΊπŸ‡ΈUnited States danielataniguchi Houston Texas

    I've worked on implementing object oriented hooks and the Backwards-compatible Hook implementation for Drupal versions from 10.1 to 11.0 according to https://www.drupal.org/node/3442349 β†’

  • πŸ‡©πŸ‡ͺGermany mxh Offenburg

    Some thoughts:

    • When implementing this on one of the next major versions that require at least Drupal 11 then I guess we don't need to consider LegacyHook or any other sort of BC layer. Just going all-in for OOP hooks.
    • I didn't look any more in detail, but one thing I noted was that hooks are being registered as listeners into the event_dispatcher service - something ECA does as well. Is it maybe possible that we merge some of our hook-related events entirely to OOP hooks, so we could reduce some class definition overhead?
  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    As mentioned before, this will go into 3.x and we don't require BC for it. Also, as the issue fork is a few months old and also has BC in it, etc. I've decided to create a new branch and start from scratch.

    And yes, I agree with @mxh in #6 that this will also make a few existing classes redundant, as we can re-use them for this purpose.

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    jurgenhaas β†’ changed the visibility of the branch 3.0.x to hidden.

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    jurgenhaas β†’ changed the visibility of the branch 2.1.x to hidden.

  • Pipeline finished with Failed
    20 days ago
    Total: 494s
    #528507
  • Pipeline finished with Failed
    20 days ago
    Total: 308s
    #528513
  • Pipeline finished with Failed
    20 days ago
    Total: 559s
    #528530
  • Pipeline finished with Failed
    20 days ago
    Total: 320s
    #528544
  • Pipeline finished with Failed
    20 days ago
    Total: 294s
    #528579
  • Pipeline finished with Failed
    20 days ago
    Total: 374s
    #528585
  • Pipeline finished with Failed
    19 days ago
    #528607
  • Pipeline finished with Failed
    19 days ago
    Total: 521s
    #529017
  • Pipeline finished with Failed
    19 days ago
    Total: 687s
    #529036
  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    This is now fully implemented and tested. The code feels cleaner now, so I'm pretty excited about that opportunity.

    Note, that the hook_module_implements_alter can only be implemented the old way, and we had that for eca_form and eca_project_browser to change the order of hook execution. I've removed those hooks entirely, and managed the processing order with an attribute.

    Will merge this, when tests are all green, as I don't expect anyone to review this. The changes are massive and hard to compare, as stuff went into different files, so the diff shows big junks of deleted and new code, which doesn't relate to each other.

    Another note: auto-wiring was a bit of a challenge, but using aliases in service files resolved it eventually.

    And last but not least, I've also disabled manual hook scans by a parameter in the services file.

  • Pipeline finished with Success
    19 days ago
    Total: 683s
    #529040
  • Pipeline finished with Skipped
    19 days ago
    #529066
  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024