Steps to reproduce:

  1. Add a tip to an existing tour
  2. Enter a two-word label
  3. Click on "Edit" next to the Machine name
  4. Follow the field description: replace the hyphen by an underscore
  5. Enjoy!

Screenshot of the error message + error-prone input

Of course we always strive for help texts that help people avoid mistakes instead of provoking them. Yet that doesn't save us from making mistakes ourselves ;-)

I haven't cross-checked with other places, maybe this is not the only occurence.

Issue fork tour_ui-3284873

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

hexabinaer created an issue. See original summary.

hexabinaer’s picture

Issue summary: View changes
elber’s picture

Assigned: Unassigned » elber
clemens.tolboom’s picture

In src/Plugin/tour_ui/tip/TipPluginTextExtended.php we have

  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {

...
    $form['id'] = [
      '#type' => 'machine_name',
      '#machine_name' => [
        'exists' => '\Drupal\tour\Entity\Tour::load',
        'replace_pattern' => '[^a-z0-9-]+',
        'replace' => '-',
      ],
      '#default_value' => $id,
      '#disabled' => !empty($id),
    ];

https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Render%21...

To me it looks like the default for replace_pattern: '[^a-z0-9_]+' and replace: '_' differ only regarding underscore '_' versus '-' dash

I cannot find a change record for this weird diff on https://www.drupal.org/list-changes/drupal/published?keywords_descriptio...

Changing the dash '-' into an underscore '_' seems to fix this.

elber’s picture

Assigned: elber » Unassigned
Status: Active » Needs review
StatusFileSize
new661 bytes
clemens.tolboom’s picture

Status: Needs review » Needs work

@elber have you found a CR?

You changed 0-9 into 0_9 which is not good ;-)

nitin_lama’s picture

Assigned: Unassigned » nitin_lama
nitin_lama’s picture

Status: Needs work » Needs review
StatusFileSize
new582 bytes
new599 bytes

Updated the patch,

nitin_lama’s picture

Assigned: nitin_lama » Unassigned
nitin_lama’s picture

Assigned: Unassigned » nitin_lama
Status: Needs review » Needs work

Assigning to myself again, uploaded the wrong patch. New patch will be uploaded in some mins.

nitin_lama’s picture

Status: Needs work » Needs review
StatusFileSize
new661 bytes
new599 bytes

Updated patch.

nitin_lama’s picture

Assigned: nitin_lama » Unassigned
clemens.tolboom’s picture

StatusFileSize
new477 bytes

Checking this with D10 https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Render%21... we can get rid of both

- replace_pattern and
- replace

  • clemens.tolboom committed ad0a34b on 8.x-1.x
    Issue #3284873 by clemens.tolboom, nitin_lama, elber, hexabinaer: Amend...
clemens.tolboom’s picture

Status: Needs review » Fixed

I tried through the UI forking and merging but that failed. So did the old way.

TNX for reporting and testing.

Status: Fixed » Closed (fixed)

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