Changes in beta1 break the experimental Autocomplete (draggable table) widget for queues with a max size. There are no autocomplete fields for unused queue slots, and clicking 'Remove' buttons for existing queue items has no effect.

The widget tests for FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED in a couple of places, so it is incompatible with the cardinality change introduced by #3021483: Hide "add another item" when queue is full.

Comments

justcaldwell created an issue. See original summary.

justcaldwell’s picture

Here's the ajax error triggered by clicking a 'Remove' button on a limited queue:

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /admin/structure/entityqueue/front_page_hero/front_page_hero?ajax_form=1
StatusText: OK
ResponseText: TypeError: Argument 1 passed to Drupal\Core\Render\MainContent\AjaxRenderer::renderResponse() must be of the type array, null given, called in /var/www/docroot/core/lib/Drupal/Core/Form/FormAjaxResponseBuilder.php on line 89 in Drupal\Core\Render\MainContent\AjaxRenderer->renderResponse() (line 45 of /var/www/docroot/core/lib/Drupal/Core/Render/MainContent/AjaxRenderer.php)."

This happens because the getWidgetElementAjax fucntion in EntityqueueDragableTableWidget.php (lines 196-199) returns null if the cardinality is anything other than unlimited:

// Ensure the widget allows adding additional items.
if ($element['#cardinality'] != FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED) {
  return NULL;
}

So, as it's currently implemented, the draggable table widget is incompatible with the enforced cardinality introduced in beta1.

justcaldwell’s picture

Title: Autocomplete (draggable table) widget broken in beta1 » Draggable table widget broken for queues with item limit
Issue summary: View changes
amateescu’s picture

Assigned: Unassigned » amateescu

Ugh.. I was afraid this day would come eventually. As mentioned in #2489514-5: Convert the draggable table widget to a FieldWidget plugin, the current code of this widget does not work very well and it probably needs to be rewritten.. again :/

I'll give it a try.

justcaldwell’s picture

Worth the effort, IMO, since draggable table is a pretty big UX improvement over standard autocomplete!

Easy for me to say, I guess, since I'm not the one doing the work :)

amateescu’s picture

Assigned: amateescu » Unassigned
Status: Active » Needs review
StatusFileSize
new14.69 KB

Here we go. With this patch, the draggable table widget seems to work reliably in every situation, so it's about time we drop the 'experimental' label and make it the default widget for subqueues!

@justcaldwell, can you please give it a spin as well and let me know if everything works correctly? :)

amateescu’s picture

StatusFileSize
new14.79 KB
new1.2 KB

Fixed a regression with the link_to_entity setting.

justcaldwell’s picture

Status: Needs review » Reviewed & tested by the community

Very nice. I tested #7 every way I could think of and it worked great. Thanks @amateescu.

  • amateescu committed c61a71b on 8.x-1.x
    Issue #3047463 by amateescu, justcaldwell: Draggable table widget broken...
amateescu’s picture

Status: Reviewed & tested by the community » Fixed

Awesome, thanks for testing!

Committed to 8.x-1.x, and I guess it's time for a beta2 release :)

Status: Fixed » Closed (fixed)

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