Problem/Motivation

The documentation for the StaticMap migrate process plugin has a couple of problems:

  • The Boolean input example description text mentions the same output string twice as the transformation for both TRUE and FALSE.
  • "foo" and "bar" are overloaded strings in the default_value example and the Boolean example.

Proposed resolution

  • "foo" and "bar" should only be used as the names of the source and destination fields, respectively.
  • Replace the overloaded strings with new values.
  • Make sure the Boolean input example description references the correct output strings.

Remaining tasks

User interface changes

N/a

Introduced terminology

N/a

API changes

N/a

Data model changes

N/a

Release notes snippet

N/a

Issue fork drupal-3619969

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

arousseau created an issue. See original summary.

rsanjuan made their first commit to this issue’s fork.

rsanjuan’s picture

Status: Active » Needs review
Issue tags: +Novice

Fixed typo in StaticMap boolean documentation. ALTIA linked.

dcam’s picture

Status: Needs review » Needs work

Thank you for your work on this issue. I noticed additional problems that are tightly coupled to this issue and I believe should be solved in conjunction with the current fix.

"foo" and "bar" are both overloaded strings in the Boolean example. I don't like it. This isn't the only place where it occurs in these docs. The default_value example also overloads "bar". It looks like the top/basic example has been copied and pasted several times and the author(s) never realized "foo" and "bar" are already in use. This is inappropriate in general, but especially for a system where the names of data fields are being referenced.

Top/basic example:

 * @code
 * process:
 *   bar:
 *     plugin: static_map
 *     source: foo
 *     map:
 *       from: to
 *       this: that
 *     bypass: TRUE
 * @endcode

We should expand the scope here to remove the overloading of "foo" and "bar" within the individual examples. I suggest that "foo" and "bar" should only be used for the source and destination field names, respectively. Anything else should be changed to alternate metasyntactic variables or something else entirely. For instance in the case of the Boolean example:

 * @code
 * process:
 *   bar:
 *     plugin: static_map
 *     source: foo
 *     map:
 *       0: baz
 *       1: qux
 * @endcode

In that case, the explanatory text already being edited in the MR should be updated with the new values.

ishfaqafridi85 made their first commit to this issue’s fork.

ishfaqafridi85’s picture

Status: Needs work » Needs review

Updated MR !16970 to address the review in comment #5.

  • Changed the overloaded default_value: bar example to default_value: fallback and updated its explanation.
  • Changed the Boolean mapping values to 0: baz and 1: qux and updated the explanation so the field names foo/bar are no longer reused as mapped values.
  • The final MR diff contains one documentation file with 6 additions and 6 removals.
  • PHP syntax, diff checks, PHPCS, PHPStan, spell-checking, PHP 8.5 unit tests, kernel tests, and functional tests pass.

Pipeline 973264 has unrelated failures in existing PHP 8.6 deprecation tests and the Nightwatch jQuery UI position shim test; retries produced the same failures. This change does not touch those tests or runtime code.

dcam’s picture

Status: Needs review » Reviewed & tested by the community

Thank you for making those changes. Let's send it up.

benjifisher’s picture

Status: Reviewed & tested by the community » Needs work

@dcam, thanks for expanding the scope (Comment #5). I completely agree that we should not use the (source and destination) variable names as the values. Personally, I would use something like "vanilla" and "chocolate" as the values, or "blue" and "green", but I will not argue with "alternate metasyntactic variables".

As a nod to my friend Guy Steele, I have to insist on the correct spelling: "quux", not "qux". So I am setting the status back to NW.

From the Wikipedia page on Metasyntactic variables, I see that both are in use. Searching the Drupal codebase, I see that "qux" is used more than "quux". But I am one of the maintainers of the migration subsystem, so I think I can insist on which one to use in the migrate module.

ishfaqafridi85’s picture

Updated MR !16970 to address the feedback in comment #9. The Boolean mapping example and its accompanying explanation now use `quux` instead of `qux`, as requested. Thank you for the review and clarification.

ishfaqafridi85’s picture

Updated the change based on the maintainer’s feedback.
The requested quux terminology is now used consistently.
This is ready for review.

ishfaqafridi85’s picture

Status: Needs work » Needs review
dcam’s picture

Title: StaticMap migrate process plugin doc seems wrong about booleans » Fix StaticMap migrate process plugin doc variable names
Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

Looks good.

I updated the issue title and summary with the expanded scope.

benjifisher’s picture

ishfaqafridi85: Thanks for indulging me.

dcam: Thanks for updating the issue summary.

+1 for RTBC

quietone’s picture

Title: Fix StaticMap migrate process plugin doc variable names » Fix StaticMap migrate process plugin doc variable names in examples

  • quietone committed 084ca800 on 11.4.x
    fix: #3619969 Fix StaticMap migrate process plugin doc variable names in...

  • quietone committed 38d5ef21 on 11.5.x
    fix: #3619969 Fix StaticMap migrate process plugin doc variable names in...

  • quietone committed f990f07b on 11.x
    fix: #3619969 Fix StaticMap migrate process plugin doc variable names in...

  • quietone committed 349fd354 on 12.0.x
    fix: #3619969 Fix StaticMap migrate process plugin doc variable names in...

  • quietone committed 347ae666 on main
    fix: #3619969 Fix StaticMap migrate process plugin doc variable names in...
quietone’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for improving the documentation!

Committed and pushed to all branches as a documentation improvements are an allowed change,

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.