Problem/Motivation

Currently this module uses a textfield to represent the machine name, and uses the form validation function to ensure that the target entity type machine name doesn't already exist. The MachineName form element used by entity type creation forms does a little more then that though. It also ensures that the machine names only contain certain characters. As it's setup right now, the module will allow machine names that contain invalid characters. This prevents you from updating the entity in the future, since it will no longer save via the admin edit screen for the entity type. I'm marking it as Critical because if you don't catch it before content authors create content using that type, the only way to correct it is via database scripts or deleting the entity type and recreating all the content.

Steps to reproduce

I'll use a paragraph as an example, but it works with any entity.

  1. Clone an existing paragraph with a machine name of "invalid-machine-name".
  2. Navigate to /admin/structure/paragraphs_type/invalid-machine-name
  3. Update something on that page, such as the description
  4. Click Save.

The form will generate an error of "The machine-readable name must contain only lowercase letters, numbers, and underscores. "

Proposed resolution

Change the clone_bundle_machine form element from a textfield to a machine_name element, which takes care of all the validation for you. Attached patch does that.

Comments

jacobbell84 created an issue. See original summary.

vuil’s picture

lukus’s picture

I can confirm this issue.

vuil’s picture

Version: 8.x-1.x-dev » 8.x-2.x-dev
Status: Needs review » Needs work
Issue tags: +Needs reroll
sourabhjain’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new2.73 KB
new5.35 KB

I have rerolled the patch. Please review.

vuil’s picture

  • vuil committed 680873be on 3.x authored by sourabhjain
    Issue #3208484 by sourabhjain, jacobbell84, vuil, lukus: Incorrect...
vuil’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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