I've had a client report that a draggable view which has previously worked reliably has lost its "save order" button.
I have reproduced the problem on dev, and it appear to be the module hook_form_alter()
code that checks for empty results and removes the button. It expects a $form['draggableviews'][0]
element to be present if there are results.
In my case this is not so - the view has results, but there is no element [0], results are keyed by nid and directly under the parent element, ie:
$form [
'draggable_views' => [
'#tree' => TRUE,
[116] => [...],
[419] => [...],
[552] => [...],
],
];
Patching that line to check for empty element_children()
fixes the problem for me, and should still catch the case where there is a single [0] element expected and that is missing:
// If there is no results remove the save-order button.
// if (!isset($form['draggableviews'][0])) {
if (empty(element_children($form['draggableviews']))) {
Any thoughts on what might be going on here?