Skip to content
Snippets Groups Projects
Commit cc7a1377 authored by Christian Adamski's avatar Christian Adamski
Browse files

#3511987 address selector

parent 29501442
No related branches found
No related tags found
No related merge requests found
Pipeline #444748 failed
......@@ -47,15 +47,17 @@ export default class GeolocationAddressWidget extends FieldWidgetBase {
getAllInputElements(returnElements = false) {
const hyphenatedFieldName = this.settings.field_name.replaceAll("_", "-");
const pattern = new RegExp(`^edit-${hyphenatedFieldName}-\\d+$`);
const pattern = new RegExp(`${hyphenatedFieldName}-\\d+$`);
const map = new Map();
const elements = this.form.querySelectorAll(`details[data-drupal-selector*="${this.settings.field_name.replaceAll("_", "-")}-"]`);
const elements = Array.from(this.form.querySelectorAll(`[data-drupal-selector*="${hyphenatedFieldName}-"]`)).filter((element) => {
return pattern.test(element.getAttribute("data-drupal-selector"));
});
if (returnElements) {
return elements;
}
const map = new Map();
elements.forEach((element) => {
map.set(this.getIndexByElement(element), element);
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment