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
Although Language is not an entity, it almost shares a structure with ConfigurableLanguage and that uses label (just as other entities do).
Beta phase evaluation
Issue category | Task because there is no error due to this. Is for consistant DX. |
---|---|
Issue priority | Normal because is only effecting Language. (Not major; is not "important by community consensus") |
Unfrozen changes | Not unfrozen because is not only changing css, tests, markup, etc. |
Prioritized changes | Might qualify for prioritized change under "reduces fragility", but probably not. |
Disruption | Not disruptive for core/contributed and custom modules/themes if it retains public method names for BC, but marks them deprecated. |
Postponed for 8.1.x because it does not meet the qualification on https://www.drupal.org/core/beta-changes ?
Proposed resolution
- In core/lib/Drupal/Core/Language/Language.php change name to label to be consistent.
- Update all uses.
- Keep old function names as a BC wrapper.
- Need a follow up issue postponed until 8.1.x. to remove the deprecated methods.
Remaining tasks
- git instructions for creating patch | Contributor task documentation for creating a patch
- perform patch reroll
- Review patch to check it fixes the issue, the change is properly documented and for coding standards. Make sure patch stays within scope of just this issue. | Contributor task documentaiton for reviewing patch
- Update the issue summary noting if allowed during the beta Instructions
User interface changes
No
API changes
No
Related issues
- Split off from #2239497: [Meta] Fix ConfigurableLanguageManager getLanguages()
- ?
Comment | File | Size | Author |
---|---|---|---|
#32 | 2246721-language_label-32.patch | 8.54 KB | yogeshmpawar |
#30 | 2246721-language_label-30.patch | 8.54 KB | yogeshmpawar |
| |||
#27 | 2246721-language_label-27.patch | 8.53 KB | martin107 |
#27 | interdiff-25.27.txt | 464 bytes | martin107 |
Comments
Comment #1
tstoecklerFWIW, I personally think label should be renamed to name instead, but I don't really care either.
Comment #2
YesCT CreditAttribution: YesCT commentedhere is a start. doing just renaming of name to label.
one thing I dont get is why this didn't have to have label(). (and id())
Comment #3
YesCT CreditAttribution: YesCT commentedwill conflict with #2246657: $options is misnamed in Language::__construct() should be property values, but that is fine. can just re-roll one when the other gets in.
Comment #5
YesCT CreditAttribution: YesCT commentedmight be a duplicate of #2246679: Make Language module's LanguageInterface (to be ConfigurableLanguageInterface) extend Core's LanguageInterface
Comment #6
YesCT CreditAttribution: YesCT commentedComment #7
martin107 CreditAttribution: martin107 commentedThis label/name thing is causing confusion in other issues. ... so I think it is worth fixing here first.
For now just a straight reroll.
Comment #9
martin107 CreditAttribution: martin107 commentedFixed fatal error preventing unit tests.
Plus fixed a smattering of the errors.. at least now more tests will run.
Still a long way to go.
Comment #11
martin107 CreditAttribution: martin107 commented#9 patch was testing in the middle of a commit spree .. CommentBlockTest.php is locally passing.. retesting just in case.
Comment #14
andypostThe opposite approach is suggested in #2246695: replace all core usages of id() with getid()
Comment #15
andypostComment #16
YesCT CreditAttribution: YesCT commentednote #2341341: Change public 'name' property access on languages to getName() and add back setName() went in.
Also, might need some kind of plan like the 3 issue set of #2350807: add getId() and make id() a wrapper for it and deprecate it
but I'm not sure. it's been awhile since I looked at this.
Comment #17
martin107 CreditAttribution: martin107 commented@YestCT, you are more aware of the wider context .... should we resolve this in 8.0.x or 8.1.x?
Comment #18
YesCT CreditAttribution: YesCT commentedneeds beta evaluation. adding instructions to summary and tag to update issue summary
Comment #19
Gábor HojtsyUpdated issue summary and title.
Comment #20
YesCT CreditAttribution: YesCT commentedname is protected now. so internal refactoring like that would not cause a backwards compatibility (BC) break.
but this would be a BC break.
We could probably add getLabel, and make getName a wrapper for that, and mark it deprecated for removal in 8.1.x
---
but I dont think removing getName would be allowed at this point in the beta.
---
I'll do a beta evaluation and update the summary.
Comment #21
YesCT CreditAttribution: YesCT commentedComment #22
YesCT CreditAttribution: YesCT commentedComment #23
Gábor HojtsyIf we don't believe this is allowed in beta, then it will be even less allowed in RC. In point releases, API changes are also avoided as possible. Then this will need to be Drupal 9 to avoid the BC break later.
Comment #24
catchAdding a new method and deprecating the old one is fine in a minor.
Also protected properties are explicitly @internal so changing that is fine.
Comment #25
martin107 CreditAttribution: martin107 as a volunteer commented@catch thanks for the @internal comment ... that is good to know.
The last patch is old ... in the mean time the properties have become protected so the @internal argument seems irrelevant.
When rerolling a 14 line patch and there are 14 conflicts ... well I have just started over.
ConfigurableLanguageUnitTest and LanguageUnitTest are green locally, so fingers crossed, but I suspect there may be at least one little gremlin.
Comment #27
martin107 CreditAttribution: martin107 as a volunteer commentedfixed.
Comment #29
andypostbtw Annotation should be changed also
should be oneliner
return $this->setLabel()
Comment #30
yogeshmpawarI have rerolled the patch as per comment #30
Comment #32
yogeshmpawarFixed the Cl error.