Allow typed data plugins to receive injected dependencies

Created on 30 July 2013, over 11 years ago
Updated 10 August 2023, over 1 year ago

Updated: Comment #72

Problem/Motivation

Typed data plugins need to have dependencies injected. See #2903549: Replace REQUEST_TIME with time service in CreatedItem β†’ as an example of plugin that can benefit from this

Proposed resolution

1. Make TypedDataManager container aware (use ContainerAwareTrait)
2a. Check if created plugin implements ContainerAwareInterface, and if yes, call its setContainer() method.
2b. Check if plugin definition contains "services" section. If no - same logic as before. If yes,
3a. Inject services in additional parameter of createInstance()
3b. Assume that plugin implements ContainerFactoryPluginInterface, call ContainerFactoryPluginInterface::create()
3c. Directly call plugin constructor

2a is 2a and 3b are fully backwards compatible.
3a should be BC as well (on assumption that no plugins use extra parameters to createInstance())

Remaining tasks

Decide what is the best approach
Write the patch
Test it
Review it

User interface changes

None

API changes

Add @service_container as a parameter of typed_data_manager service

Related Issues

#1951268: Convert /forum and /forum/% to new router, remove forum_forum_load(), forum_get_topics(), create Forum service β†’
✨ Allow Plugins to specify Services via Annotation Closed: duplicate

πŸ“Œ Task
Status

Closed: duplicate

Version

11.0 πŸ”₯

Component
Typed dataΒ  β†’

Last updated 13 days ago

  • Maintained by
  • πŸ‡¦πŸ‡ΉAustria @fago
Created by

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

Live updates comments and jobs are added and updated live.
  • API change

    Changes an existing API or subsystem. Not backportable to earlier major versions, unless absolutely required to fix a critical bug.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024