Currently in Draggableviews 8.x-1.x you can only get views to write to its own "native" table (draggableviews_structure). In 7.x-2.x you had the option to use the FieldAPI. I also attempted to test the weight to each entity, but failed because of the limitation of drupal 7.x (TODO: add issue link here). Drupal 8.x was extremely more promising.

This will probably not go into 8.x-1.1, but might be a candidate for 8.x-1.2, if I get time to write this. Any help would be appreciated.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

iStryker created an issue. See original summary.

mpp’s picture

Using the Field API and supporting the weight module would be great!

brunodbo’s picture

I started porting Flag weights to D8 because of its integration with DraggableViews (see #2934789: Port Flag Weights to Drupal 8, so (I think?) I'm going to need this as well. Happy to try and get started on this, but could use some pointers. Is there anything in the D7 version I could look at as a basis for this?

brunodbo’s picture

I had a look at how this is done in the D7 version. Looks like we would have to:

- Add a draggable_views_handler class, containing a get() and set() method, that other modules can extend.
- Add subclasses for native handling of storing weights, and one to support Field API fields.
- Allow users to configure the handler in the DraggableViews field form in the Views UI.
- Then in draggableviews_views_submit(), we pass off the saving of weights to the handler class.

This is all assuming we follow the same approach as in the D7 version. @iStryker, is that what you had in mind?

brunodbo’s picture

Attached patch is work in progress, not yet functional.

It implements a DraggableViewsHandler plugin type, along with a DraggableViewsHandlerNative plugin. If you apply the patch, and go to the settings form for the DraggableViews views field, you should be able to see the native handler as an option.

The native handler plugin doesn't work yet (it currently just contains the code from the 7.x native handler plugin), that's the next step. After that we can implement the Field API handler plugin, and the Flag Weights one (over in the Flag Weights module).

4kant’s picture

We are using field api plugin in several drupal 7 projects where we have individual sort criterias for similar lists of nodes.
Would be great to have this feature in D8/9 again.

Thanks!