- 🇩🇪Germany Anybody Porta Westfalica
@rp7 thanks - could you turn this into a MR and maybe add a test for this case?
Probably an edge-case here, but nevertheless a bug AFAICT.
I'm connecting to an external - out of my control - data source using http://drupal.org/project/external_entities. The entity types entities have uppercase IDs. I'm displaying these entities in an multi-step view entity browser.
The "Remove" button on the selected items, however, doesn't do anything - at first sight. If I click it, a temporary AJAX loading screen appears but the item itself is not removed. Only when the page (iframe in my case, displayed in a modal) is refreshed, the item is removed.
I found out that the root cause for this is is that my entities have uppercase IDs. A screenshot of the HTML snippet of an item that has been selected:
As you can see the data-drupal-selector attribute contains the ID in lowercase, while the data-remove-entity attribute contains the ID in uppercase. It appears Drupal always lowercases the data-drupal-selector attribute.
What happens in entity_browser.multi_step_display.js is the following:
var button_element = $(event.target);
var remove_entity_id = button_element.attr('data-remove-entity') + '_' + button_element.attr('data-row-id');
$entities.trigger('remove-entities', [[remove_entity_id]]);
remove_entity_id here has the ID in uppercase. Going further...
// Remove dom element, and queue entity for removal in backend.
var element_selector = '[data-drupal-selector="edit-selected-'.concat(entity_ids[i].replace(/_/g, '-'), '"]');
entities_list.find(element_selector).remove();
element_selector is being constructed with the uppercase ID, but the element will never be found since it exists in the DOM with a lowercase ID.
Needs work
2.0
Display plugins
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
@rp7 thanks - could you turn this into a MR and maybe add a test for this case?