Remove usage of "$config->get('etracker_multilingual')" in array context

Created on 15 December 2022, almost 2 years ago
Updated 7 October 2024, about 1 month ago

Problem/Motivation

Currently in "etracker.module", "_etracker_get_language_settings()", we use the following code:

$language_settings = count($languages) == 1 ?
    [
      'tag' => 0,
      'area prefix' => 0,
      'area suffix' => 0,
      'page title prefix' => 0,
    ]
    : $config->get('etracker_multilingual');

  $language_settings['current language'] = Drupal::languageManager()
    ->getCurrentLanguage()
    ->getId();

This code has two issues:
The config value etracker_multilingual is not defined
"$language_settings['current language']" will result in an error, when "config->get('etracker_multilingual');" returns NULL or an object.

In Drupal 7 it was implemented like this:
https://git.drupalcode.org/search?group_id=2&project_id=5078&scope=blobs...

Steps to reproduce

Proposed resolution

Replace $config->get('etracker_multilingual'); with [];

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs review

Version

3.0

Component

Code

Created by

🇩🇪Germany Grevil

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇩🇪Germany Anybody Porta Westfalica

    @sunlix: Any chance for maintainer feedback to make a decision here?

  • First commit to issue fork.
  • 🇩🇪Germany Anybody Porta Westfalica

    Yeah as just discussed, let's simply remove that part and add a follow-up to refactor the multilang by config translation (minor). Guess it wasn't used before.

  • 🇩🇪Germany sunlix Wesel

    Hey there,

    as discussed latlely with @Anybody I have adjusted the suggested solution from @Grevil a bit.
    It makes no sense to have a different behavior only if there is one language installed in the system.
    So we streamline the returned array for all languages.

    There as in general a lot of confusing stuff in there :D
    The page title get the language code as a suffix if page title suffix not empty.
    But that key is never set and we do not have any kind of configuration for that.

    By time the whole .module hooks should get a meaningful refactorisation. :)

  • 🇩🇪Germany Anybody Porta Westfalica

    Yeah we came to the conclusion that this part of code came from Drupal 7 - 5 years ago and seems to have been more or less copied as-is, without thinking about it too much. We guess nobody really used it.

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

Production build 0.71.5 2024