Problem/Motivation

The new D11 hooks autoregister every class in the Hooks namespace as a service.
This is nice for DX and OK for small projects.

For any medium to large object, it is bad for DX, as the hook classes should better be where related funcitonality is.

Proposed resolution

Autoregister every class namale *Hooks as a service.

Remaining tasks

Code, review, commit.

User interface changes

None.

Introduced terminology

None.

API changes

None.
No more BC issues that autoregistering the Hooks directory made.

Data model changes

None

Release notes snippet

*Hooks classes are autoregistered.

Comments

geek-merlin created an issue. See original summary.

geek-merlin’s picture

Title: Autoregister every Class named *Hooks » Autoregister Classs named *Hooks as a service
quietone’s picture

Version: 11.1.x-dev » 11.x-dev
longwave’s picture

I am not sure more magic naming here is better, maybe it would be better to explicitly declare this in services.yml, which Symfony already supports but Drupal does not: #3021899: Support resource key in services.yml

nicxvan’s picture

nicxvan’s picture

Component: base system » extension system
Status: Active » Closed (duplicate)

I'm going to close this as a duplicate as the other issue will cover this use case.

Please feel free to comment if I am mistaken.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.