Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
As we have seen in #2781207: Use class resolver for abstracted Content Moderation classes the class_resolver
Proposed resolution
Let's add it to \Drupal
Advantages
- Discoverability
- Documentability
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#19 | interdiff.txt | 696 bytes | claudiu.cristea |
#19 | 2785355-19.patch | 1.68 KB | claudiu.cristea |
Comments
Comment #2
timmillwoodInitial implementation.
Did wonder if we should return the basic class resolver object, or accept a class name and pass directly to
getInstanceFromDefinition()
? Went for returning a basic class resolver object.Comment #3
dawehner+1 for not doing some additional magic beside getting the service from the container.
Comment #4
timmillwoodAdding test.
Comment #5
dawehnerWFM
Comment #6
dawehnerWait, actually I think we should document legit usecases of this function
Comment #11
timmillwoodAdding basic docs to the method.
Comment #13
dawehnerSmall expansion of the documentation.
Comment #14
timmillwoodWFM
As long as the test passes, RTBC!
Comment #15
borisson_Nitpick: I think the classname should be on the next line to respect 80 cols.
Comment #16
timmillwood@borisson_ IIRC the 80 cols restriction is only for the first line, but I might be wrong. I did think about putting the class name on the third line, but that then made the third line longer than the second, which looked odd.
Anyway, I'll leave it up to the committer to do on commit.
Comment #17
dawehnerNope the 80 chars limit is for every line.
from https://www.drupal.org/node/1354
Comment #19
claudiu.cristeaFixing #15.
Comment #20
dawehnerThank you @claudiu.cristea
Comment #21
xjmI was hesitant about this issue based on the title/summary, but the documentation in the patch itself makes a compelling case for this API addition. Committed 9d3d930 and pushed to 8.3.x. Thanks!
Comment #23
xjmWell this change was out of scope, but oops, committed anyway. :)