Problem/Motivation

In a number of configuration system/configuration schema issue now, the confusing nature of the term "variable value" has come up.

Quoting \Drupal\Core\Config\TypedConfigManager::replaceVariable():

  /**
   * Replaces variable values in included names with configuration data.
   *
   * Variable values are nested configuration keys that will be replaced by
   * their value or some of these special strings:
   * - '%key', will be replaced by the element's key.
   * - '%parent', to reference the parent element.
   * - '%type', to reference the schema definition type. Can only be used in
   *   combination with %parent.
   *
   * There may be nested configuration keys separated by dots or more complex
   * patterns like '%parent.name' which references the 'name' value of the
   * parent element.
…

Steps to reproduce

N/A

Proposed resolution

Rename "variable value" to "dynamic placeholder".

Rename "variable value" to "dynamic type name", since that terminology was +1'd by configuration system maintainer Alex Pott in #2392057: Config schema fails to expand dynamic top-level types. But there's a distinction between the entire dynamic type name and the parts in there that are dynamic. I propose the word "expression", since it must be evaluated.

Remaining tasks

Review.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

N/A

Issue fork drupal-3406487

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Wim Leers created an issue. See original summary.

wim leers’s picture

Use the term dynamic type names, which #2392057: Config schema fails to expand dynamic top-level types introduced for TypedConfigManager::getDefinitionWithReplacements()'s

   * @param array $replacements
   *   An array of replacements for dynamic type names.

.

Related: #3392903: Validate inputs of TypeResolver::resolveExpression(): only allow %parent, %type and %key.

wim leers’s picture

Issue summary: View changes
wim leers’s picture

Title: TypedConfigManager's "variable value" terminology is confusing » Consistently use "dynamic type name" instead of "variable value" in TypedConfigManager's terminology

Better title.

wim leers’s picture

Title: Consistently use "dynamic type name" instead of "variable value" in TypedConfigManager's terminology » Consistently use "dynamic type name" and "expression" instead of "variable value" in TypedConfigManager's terminology
Issue summary: View changes
borisson_’s picture

I agree that dynamic type expression is clearer than variable value. I think this is a good improvement.

phenaproxima’s picture

I like "dynamic type name" as a consistent term. I also like "expression" to refer to the stuff between square brackets, although we definitely want to be sure we have examples of what "expressions" look like, since it's a more generic word. And indeed, there are already examples in the doc comments we're changing, so...full steam ahead!

phenaproxima’s picture

Status: Needs review » Needs work

Couple minor suggestions but this is light-years better than what's in HEAD. As far as I'm concerned, RTBC once my points are resolved. :)

wim leers’s picture

Status: Needs work » Needs review

Done!

phenaproxima’s picture

Status: Needs review » Reviewed & tested by the community

Send it forth!

bircher’s picture

I was not bothered too much about the old name, but I agree that this is an improvement.

RTBC +1

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

Let's preserve BC and add replaceName/Variable back it but trigger deprecations.

wim leers’s picture

Assigned: Unassigned » wim leers
wim leers’s picture

Assigned: wim leers » Unassigned
Status: Needs work » Reviewed & tested by the community

Self re-RTBC'ing because this is such a trivial change.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 2dc7b23 and pushed to 11.x. Thanks!

  • alexpott committed 2dc7b233 on 11.x
    Issue #3406487 by Wim Leers, phenaproxima: Consistently use "dynamic...

Status: Fixed » Closed (fixed)

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