🇨🇭Switzerland @shiq

Account created on 4 August 2015, over 9 years ago
#

Recent comments

🇨🇭Switzerland shiq

Got the same error after upgrading PHP to 8.1, I found a temporary workaround with a hook.
Since the Drupal\views\ResultRow::$draggableviews_structure_parent is undefined before the drag and drop action, set it to be default to 0.

Here's the hook:

function hook_views_pre_render(ViewExecutable $view) {
  // Bug draggableviews and custom sorts (Warning: Undefined property: Drupal\views\ResultRow::$draggableviews_structure_parent).
  $v_fields = array_keys($view->field);
  $results = $view->result;
  if(in_array('draggableviews', $v_fields)){
    foreach($results as $row){
      if(!isset($row->draggableviews_structure_parent)){
        $row->draggableviews_structure_parent = 0;
      }
    }

  }
}

Works fine for me, tested also after drag drop action.
Hope it helps,

Production build 0.71.5 2024