integer-net/magento2-cli-scope-hint

Use source models for select and multiselect configuration fields

Opened this issue · 2 comments

When retrieving a value of a select or multiselect field, the ID(s) are returned. For example: the country configuration general/country/default will return "DE".
I'd like to return "Germany" or "Deutschland", depending on the locale setting. Ideally, it'd return "Germany (DE)" or something like that. I could also think of making it configurable or providing an extra column with the "speaking" value. What do you think?

The same goes for multiselect fields like general/country/allow which return comma seperated lists like "DE,AT,CH".

For retrieving the speaking value, you can use the source model which is assigned to a config field.

@avstudnitz Yes, I think that is a good enhancement. So you directly see the country names (most probably don't know all country codes from memory.

So the adjustment would be:

  • by default instead of country codes (DE, AT, etc) the country names (in the configured BE language) with codes in brackets are shown (Germany (DE), Austria (AT), etc.)
  • with an extra parameter --only-country-codes only the country codes are shown

An extra column for the country codes are not necessary I think.

@schmengler Do you agree with this?

@a-leurs Country codes are just one example, so can you come up with a better parameter name than --only-country-codes?

"value" and "label" are typically used in Magento to distinguish the saved value and the user friendly translated label