Skip to content
Snippets Groups Projects

Generate the Media library field_widget_id as more 'unique'

Open Antoine Hendrickx requested to merge issue/drupal-3345064:3345064-11.x into 11.x
1 unresolved thread

Closes #3345064

Merge request reports

Members who can merge are allowed to add commits.
Approval is optional
Ready to merge by members who can write to the target branch.

Merge details

  • The source branch is 3116 commits behind the target branch.
  • 1 commit and 1 merge commit will be added to .
  • Source branch will not be deleted.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
312 312 $field_name = $this->fieldDefinition->getName();
313 313 $parents = $form['#parents'];
314 314 // Create an ID suffix from the parents to make sure each widget is unique.
315 $id_suffix = $parents ? '-' . implode('-', $parents) : '';
315 $id_suffix = $parents ? '-' . implode('-', $parents) : $this->fieldDefinition->getUniqueIdentifier();
316 316 $field_widget_id = implode(':', array_filter([$field_name, $id_suffix]));
317 317 $wrapper_id = $field_name . '-media-library-wrapper' . $id_suffix;
  • Comment on lines -315 to 317

    The wrapper id should have a sepperator between the field name and the id_suffix.

    Suggested change
    317 $id_suffix = $parents ? '-' . implode('-', $parents) : $this->fieldDefinition->getUniqueIdentifier();
    318 $field_widget_id = implode(':', array_filter([$field_name, $id_suffix]));
    319 $wrapper_id = $field_name . '-media-library-wrapper' . $id_suffix;
    317 $id_suffix = $parents ? implode('-', $parents) : $this->fieldDefinition->getUniqueIdentifier();
    318 $field_widget_id = implode(':', array_filter([$field_name, $id_suffix]));
    319 $wrapper_id = $field_name . '-media-library-wrapper' . '-' . $id_suffix;
  • Please register or sign in to reply
Please register or sign in to reply
Loading