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
Drupal\language\Plugin\Condition\Language
does not take the language manager injected and is not unit tested.
Proposed resolution
Inject language manager, unit test.
Remaining tasks
All of them.
User interface changes
None.
API changes
Likely none.
Comment | File | Size | Author |
---|---|---|---|
#2 | 2328463-languagemanager_injected-2.patch | 839 bytes | janoka |
Comments
Comment #1
janoka CreditAttribution: janoka commentedI'll check it.
Comment #2
janoka CreditAttribution: janoka commentedPlease check my code. Do you think that solution? If yes, then I will write the unit test.
Comment #3
Gábor HojtsyCertainly better than using language_list() :) Actually injecting the language manager would mean you pass on an instance of $language_manager as a property to either the constructor or create method or a specific setter method that is used to set dependent services on conditions. See https://www.drupal.org/node/2133171 for explanation on various ways of of injection and check what conditions use elsewhere. (They may not support injection yet but hopefully they do :)
Comment #4
janoka CreditAttribution: janoka commentedComment #5
janoka CreditAttribution: janoka commentedComment #6
janoka CreditAttribution: janoka commentedI started check it again.
Comment #7
janoka CreditAttribution: janoka commentedComment #8
janoka CreditAttribution: janoka commentedMarking as duplicate of #2328293: Remove usage of language_list().