- Issue created by @alexpott
- π¬π§United Kingdom alexpott πͺπΊπ
Closed in favour of β¨ Support hooks (Hook attribute) in components Active - thanks @Berdir
We have a lovely new hooks system that integrates the module handler and the event dispatcher to invoke hooks. In doing this we had to move a hook. core_field_views_data to \Drupal\views\Hook\ViewsViewsHooks::fieldViewsData() even though what it does - provide entity reference field integration with views could be considered to be core's responsibility.
Also we've always had an issue with things that are not Drupal module's subscribing to events - for example PHP libraries. Another example could be kernel tests to enable hook testing whether the test and the test hook implementation live side-by-side - see π Make hook testing with kernel tests very simple Active
Also this could be used to make things like
/**
* Implements hook_cron().
*/
#[Hook('cron')]
public function cron(): void {
$this->workspaceManager->purgeDeletedWorkspacesBatch();
}
from \Drupal\workspaces\Hook\WorkspacesHooks simpler. \Drupal\workspaces\WorkspaceManager::purgeDeletedWorkspacesBatch could subscribe to the hook - although we'd have to ensure anything that decorates it is also subscribed...
Allow services in some way to subscribe to hooks just like they can to other events.
None
None
TBD
None
TBD
Active
11.0 π₯
base system
Closed in favour of β¨ Support hooks (Hook attribute) in components Active - thanks @Berdir