Support from Acquia helps fund testing for Drupal Acquia logo

Comments

goodDenis created an issue. See original summary.

goodDenis’s picture

Status: Active » Needs review
FileSize
1.67 KB

With this patch, you can use 'node type' or 'media type', but not both. Because in the 'draggableviews_structure' table we don't keep 'entity type' and 'parent entity type'.

goodDenis’s picture

FileSize
1.68 KB

Fix getting entity, please use the latest path.

iStryker’s picture

Tried your patch with Drupal core 8.7.7, latest 8.x-1.x. I see it does not work with a view of "Media" without your patch. With your patch it still does not work. No draggable + show up on the table.

Looking at the patch, it does look like it should work. What version of Core you using?

goodDenis’s picture

It works for me at 8.7.8
Did you see 'Draggableviews: Media' in the 'FIELDS'?

  • goodDenis authored 98a25cb on 8.x-1.x
    Issue #3089597 by goodDenis: Support media entity type
    
iStryker’s picture

Status: Needs review » Fixed

Got it to work. Comitted

iStryker’s picture

Status: Fixed » Needs work
FileSize
44.31 KB

Wait I think this needs works. After saving 1 view with 3 images, and having the draggableviews demo with 5 items, now there is duplicates. Images go from 3 items to 6, DV Demos goes from 5 to 8. I think its because they have conflicting entity Ids. See attached image.

duplicate entries

goodDenis’s picture

Assigned: goodDenis » Unassigned

I will try to check it, but right now I don't have much time, Changing the assigned status.

goodDenis’s picture

Assigned: Unassigned » goodDenis
goodDenis’s picture

Status: Needs work » Needs review
FileSize
1.53 KB

The problem was with join `draggableviews_structure` table to the view. We should add additional conditions `view_name` and `view_display`.
The SQL query was
LEFT JOIN {draggableviews_structure} draggableviews_structure ON media_field_data.mid = draggableviews_structure.entity_id
and I change it to
LEFT JOIN {draggableviews_structure} draggableviews_structure ON media_field_data.mid = draggableviews_structure.entity_id AND (draggableviews_structure.view_name = 'VIEW_NAME' AND draggableviews_structure.view_display = 'VIEW_DISPLAY')
Added patch.

  • iStryker committed 606c58e on 8.x-1.x authored by goodDenis
    Issue #3089597 by goodDenis, iStryker: Add additonal joins on view name...
iStryker’s picture

Status: Needs review » Fixed

Test and committed. I am surprised this hasn't caused other problems with other issues.

dkosbob’s picture

I'm fairly certain the views_query_alter committed in this issue broke the functionality of the module on my views. Removing it restores expected behavior. Here is a patch that just removes that for anyone who needs it, but it sounds like that may invalidate the work done earlier in this issue.

dkosbob’s picture

Status: Fixed » Needs review
goodDenis’s picture

Hello, @dkosbob
Could you provide some information about the problem? Do you have any error message?
This hook_views_query_alter change JOIN

LEFT JOIN {draggableviews_structure} draggableviews_structure ON media_field_data.mid = draggableviews_structure.entity_id
to
LEFT JOIN {draggableviews_structure} draggableviews_structure ON media_field_data.mid = draggableviews_structure.entity_id AND (draggableviews_structure.view_name = 'VIEW_NAME' AND draggableviews_structure.view_display = 'VIEW_DISPLAY')

iStryker’s picture

In theory it shouldn't because view display and view name are already added to the database. The commit just adds them to the query.

goodDenis’s picture

Assigned: goodDenis » Unassigned
iStryker’s picture

Status: Needs review » Fixed
Related issues: +#3158196: Allow any entity in DraggableViews::getIndex()

Reclosing isssue as only @dkosbob is having problems. There are other issue like his in other issues. Marking back as fixed for this issue.

Better solution #3158196: Allow any entity in DraggableViews::getIndex(). This is what I was looking for. It not mid or nid specific.

Status: Fixed » Closed (fixed)

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

robertom’s picture

I have the same problem as @dkosbob

the problem is discussed on #3153830: DraggableViews not working after update to 2.0.0

dejan0’s picture

+1
same here