As of commit 24e6ce2cf603bbb5bad008ad14b7a1fedd91e674 it appears that only nodes may be the base table for views using the draggable views style plugin. Since all entities are fieldable now it would be valuable to allow for any base table to be used. I'll be uploading a patch shortly with changes that begin to expose this capability.

Comments

tekante’s picture

StatusFileSize
new2.39 KB

The attached patch will allow any base table to be used with the draggable views style as long as the ordering element uses the field handler and not the native handler. Potential issues are:

1. No testing has been done attempting to use the native handler
2. Translatable entities/fields may not store data correctly (search patch for LANGUAGE_NONE)

mlncn’s picture

Status: Active » Needs review
mlncn’s picture

Leaving this at needs review because i suspect it will work for someone setting up a view fresh.

I think my problem is that i need to add the file ID as a field to my view (true?) and that in the meantime the preview display is choking without this.

My error messages quarantined over at my site http://data.agaric.com/making-draggableviews-work-files-and-any-entity-n...

Thanks greatly tekante for the patch and i hope it's a configuration issue on my end that it is not working with Files. Will be back to try / test more this afternoon.

jantimon’s picture

Tekantes patch does not allow to use fields which are not in the base table.
I reworked this and the language setting.

As I had no time today I will test it tomorrow and attach the patch.

jantimon’s picture

StatusFileSize
new4.14 KB

The patch works for me for:

Nodes without relations
Entities without relations
Nodes with relations
Entities with relations

As the name of my entity base table differs from the entity name I have to iterate through entity_get_info();
Is there a better way to search an entity type for a given base_table?

+    // Get the entity type for this field
+    $entity_info = entity_get_info();
+    foreach ($entity_info as $entity_type => $entity) {
+      if ($entity['base table'] == $this->field->base_table) {
+        $this->entity_type = $entity_type;
+        break;
+      }
+    }
jantimon’s picture

philipz’s picture

The #1 and #6 patch are working for me. I tried them hoping they would fix the Field API handler ordering and it did. Thanks guys!

Anonymous’s picture

I'm getting this error with patch #6 and #5

Fatal error: Call to undefined function entity_load_single() in D:\xampp\htdocs\drupal3\sites\all\modules\draggableviews\implementations\draggableviews_handler_fieldapi.inc on line 57
Executed 25 queries in 12.94 ms. Queries exceeding 5 ms are highlighted.

What am I doing wrong?

jantimon’s picture

Sorry my bad. I used entity_load_single from the entity api module.

jantimon’s picture

Anonymous’s picture

Hmm, I used the last patch, but I receive this error:

Fatal error: Unsupported operand types in D:\xampp\htdocs\drupal2\includes\entity.inc on line 354

medden’s picture

I get the following error after applying the last patch.

Notice: Undefined index: und in views_handler_field_field->get_value() (line 719 of /var/www/site/dev/d7/sites/all/modules/contrib/views/modules/field/views_handler_field_field.inc).

I am trying to get draggableview to set a parent using the reference module and fieldAPI, It doens't seem to be working either with or without this patch.

I upgraded views to views-3-dev rather than rc1 and now I get this error:
Warning: array_flip() expects parameter 1 to be array, integer given in DrupalDefaultEntityController->load() (line 178 of /var/www/site/dev/d7/includes/entity.inc).

crispinbailey’s picture

+1

mtravers’s picture

This patch should fix comment #11 and I think #12.

mtravers’s picture

This attached patch is the same as the -11.patch in post #14, except that it was made using git diff.

jantimon’s picture

Oh yeah I forgot to commit the array patch.
Thanks mtravers.

ymeiner’s picture

#14 and #15 did not solve #12.

I get the same errors.

medden’s picture

I get the following error after applying that patch....
Notice: Undefined index: id in draggableviews_views_pre_execute() (line 252 of /***/sites/all/modules/contrib/draggableviews/draggableviews.module).

However the functionality now seems to work exactly as it should. I can get parent and order fields to save and display correctly using the FieldAPI in the Draggable Views settings.

Any ideas how to fix the error though?

nirbhasa’s picture

I can confirm the patch also works for me. Thanks to everyone who worked on it!

klonos’s picture

medden’s picture

I can confirm that downloading a fresh 7-01 dev version of this module and applying the patch mentioned in #20 worked.
No more error messages.

Thanks Klonos!

klonos’s picture

@medden: thanx for taking the time to report back. I'm glad it worked for you. Can you please repeat your confirmation that it works in the other issue's queue where it belongs ;)

istryker’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Status: Needs review » Fixed

The patches in the previous comments are for 7.x-1.x-dev. This is now an unsupported branch. Everything should be fixed in 7.x-2.0 and 7.x-2.x-dev.

I think the only thing that is not working is Entity References and Field Collections. They have their own issues
#1777646: How to work with Entity References
#1904182: Save to Field Collection item ID

If I am wrong, then reopen this issue, or, because of the age of this issue, create a new one.

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes
Status: Closed (fixed) » Active

I'm reopening this issue because it doesn't work on the current branch. I also created a second issue, as I'm not sure what the best way is to work on this. https://www.drupal.org/node/2298207

lsolesen’s picture

Status: Active » Fixed

Setting back to fixed.

Status: Fixed » Closed (fixed)

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