Problem/Motivation

Follow up to #3070354: Add a test for locale_translation_build_projects() to unensure that 'core' key does not affect translations URLs

In that issue we wrote a test to prove that the 'core' value in 'projects' for the locale module does not come from the 'core' key in the module's info.yml file.

But locale_translation_build_projects() still has
'core' => isset($data['info']['core']) ? $data['info']['core'] : \Drupal::CORE_COMPATIBILITY,

Because $data here comes from locale_translation_project_list() which ultimately calls \Drupal\Core\Utility\ProjectInfo::filterProjectInfo() which will filter out the 'core' key that comes from the info.yml file the only place the 'info' can be added back is in hook_locale_translation_projects(). But if you read the documentation for this hook it is not intended for this purpose.

It also seems very unlikely that this hook would be used this way because

  1. There would have to be someone hosting their own localization server
  2. The would have to want 'core' key for localization server to vary per project not based on the actually version of Drupal core is running

Proposed resolution

Change the above code to
<code>'core' => \Drupal::CORE_COMPATIBILITY,

Remaining tasks

Do it

User interface changes

None

API changes

None

Data model changes

Release notes snippet

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tedbow created an issue. See original summary.

tedbow’s picture

Status: Active » Needs review
FileSize
913 bytes
6.31 KB

Here is patch and another patch with the test in [3070354-5] to prove it doesn't break that test

tedbow’s picture

i messed up drupalci in 3073934-2-plus-3070354-5.patch

xjm’s picture

Issue tags: +mwds2019
Gábor Hojtsy’s picture

  • Gábor Hojtsy committed bf4caf9 on 8.8.x
    Issue #3073934 by tedbow, xjm, Gábor Hojtsy: Remove dead code path in...
Gábor Hojtsy’s picture

Status: Needs review » Fixed

I agree with the analyses, good find. Thanks! (This already got test coverage in #3070354: Add a test for locale_translation_build_projects() to unensure that 'core' key does not affect translations URLs).

tedbow’s picture

@Gábor Hojtsy thanks for committing this!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.