- ๐ซ๐ทFrance steveoriol Grenoble ๐ซ๐ท
Great, it works for me
thank you - ๐บ๐ธUnited States adrianm6254
I could not apply the patch
- Installing drupal/draggableviews (2.1.2): Extracting archive
- Applying patches for drupal/draggableviews
https://git.drupalcode.org/project/draggableviews/-/merge_requests/18 (3346320 - Undefined draggableviews_structure_parent)
Could not apply patch! Skipping. The error was: Cannot apply patch https://git.drupalcode.org/project/draggableviews/-/merge_requests/18or
- Installing drupal/draggableviews (dev-2.1.x 8799f32): Cloning 8799f32881 from cache
- Applying patches for drupal/draggableviews
https://git.drupalcode.org/project/draggableviews/-/merge_requests/18 (3346320 - Undefined draggableviews_structure_parent)
Could not apply patch! Skipping. The error was: Cannot apply patch https://git.drupalcode.org/project/draggableviews/-/merge_requests/18 - ๐ธ๐ฎSlovenia joco_sp
@Adrianm6254 it should work on 2.1.2. I tested it on multiple websites with that version.
You can add those lines to your composer.json
"patches": { "drupal/draggableviews": { "Undefined draggableviews_structure_parent => https://www.drupal.org/project/draggableviews/issues/3346320": "https://git.drupalcode.org/issue/draggableviews-3346320/-/commit/4988d648001430ef4496899e8d8205364c6bc595.patch" } }
or use the direct link to the patch and apply it as you are used to:
https://git.drupalcode.org/issue/draggableviews-3346320/-/commit/4988d648001430ef4496899e8d8205364c6bc595.patch
- ๐ณ๐ฟNew Zealand haydent
Have tested this as well and it works well. What use to be a screen of warning messages is no more. Thanks @joco_sp.
- ๐ณ๐ดNorway vegardjo
Thanks, can confirm that this works too.
@joco_sp: I didn't know you could get the patch file URL directly from GitLab, I've only seen the download option before. Is there a UI I'm not seeing here, or you simply have to know to add
.patch
on the URL? (I also found it works directly at a PR too: https://git.drupalcode.org/project/draggableviews/-/merge_requests/18.patch) - In any ways: thanks for the tip :) - ๐ธ๐ฎSlovenia joco_sp
@vegardjo I just added .patch at the end :) I didn't like using the Merge request, because I'm not sure if somebody else can change it. I preferred to use my specific commit. Just to avoid possible problems. And it worked :D
- ๐ณ๐ดNorway vegardjo
Good point, with a single file change it's probably best to add it to the commit instead, anyways a nice trick! :)
- ๐จ๐ฆCanada lily.yan
I can apply patch https://git.drupalcode.org/project/draggableviews/-/merge_requests/18.patch to draggableviews 2.1.2 successfully. It can fix the issue.
- ๐บ๐ธUnited States dwisnousky
Moving the merge request patch to a patch that can't be changed to be safe. Works for us! Thank you kindly!
- ๐ธ๐ฎSlovenia joco_sp
@dwisnousky no need for that. There is already one. If you add the .patch at the end to the commit, you have it :) -> https://git.drupalcode.org/issue/draggableviews-3346320/-/commit/4988d64...
Hope it's useful for the future. - ๐บ๐ธUnited States z3cka
While the MR/patch, and the improvement suggested above, does make the warnings go awayโit does not get to the root of the issue.
The question, for me, is what does `draggableviews_structure_parent` represent and when/where is it ever set to a value? `$row` in this context is of type `\Drupal\views\ResultRow` which does not have the `draggableviews_structure_parent` property. Most other usages of this property also have protections around it. Do we need the `draggableviews_structure_parent` property at all? What use/test case am I missing here?
Thanks!
- ๐จ๐ญ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, - Status changed to Closed: duplicate
over 1 year ago 7:43pm 25 April 2023 - ๐บ๐ธUnited States douggreen Winchester, VA
This is no longer needed, solved in the latest https://www.drupal.org/project/draggableviews/releases/2.1.3 โ , which shows this diff https://git.drupalcode.org/project/draggableviews/-/compare/2.1.2...2.1....
This apparently has been committed for some time, just needed a new release.