Problem/Motivation
In some circumstances in page /admin/reports/translations 'Available translation updates' sets of 3 warnings happens,
Warning: Undefined array key "datatables"
in Drupal\locale\Form\TranslationStatusForm->prepareUpdateData() (line 203 of core/modules/locale/src/Form/TranslationStatusForm.php).
Warning: Attempt to read property "info" on null
in Drupal\locale\Form\TranslationStatusForm->prepareUpdateData() (line 203 of core/modules/locale/src/Form/TranslationStatusForm.php).
Warning: Trying to access array offset on value of type null
in Drupal\locale\Form\TranslationStatusForm->prepareUpdateData() (line 203 of core/modules/locale/src/Form/TranslationStatusForm.php).
With the additional message,
#0 */web/core/includes/bootstrap.inc(164): _drupal_error_handler_real()
#1 */web/core/modules/locale/src/Form/TranslationStatusForm.php(203): _drupal_error_handler()
#2 */web/core/modules/locale/src/Form/TranslationStatusForm.php(78): Drupal\locale\Form\TranslationStatusForm->prepareUpdateData()
#3 [internal function]: Drupal\locale\Form\TranslationStatusForm->buildForm()
#4 */web/core/lib/Drupal/Core/Form/FormBuilder.php(536): call_user_func_array()
#5 */web/core/lib/Drupal/Core/Form/FormBuilder.php(283): Drupal\Core\Form\FormBuilder->retrieveForm()
#6 */web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm()
Where "datatables" is a module and could be different. The line 203 in core/modules/locale/src/Form/TranslationStatusForm.php
is,
'name' => $project_info->name == 'drupal' ? $this->t('Drupal core') : $project_data[$project_info->name]->info['name'],
$project_info->name
is the module name. $project_data[$project_info->name]->info['name']
is the value of the key project
in the file <module name>.info.yml
. Such a problem happens for a module when no key project
exists in its info.yml
file.
Steps to reproduce
With Drupal 10.2 in page /admin/reports/translations
.
If no problems exist alter the info.yml
of a module removing the line project
.
Proposed resolution
These are errors/warnings and should be corrected. Actually to solve the problem the file info.yml
should have the key project
with a value. This key is one of the ones automatically add to the file info.yml
by Drupal.org packaging script when a new release is created, with keys version
and datestamp
.
- Either the rule stands that a module should have file info.yml
with the key project
,
- Or the logic of this code might be changed.
However what is actually a list of modules producing errors could be changed in a list of modules with an abnormal info.yml
file. A potentially interesting information. Here stands a means to get it.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet