User login

Making DraggableViews work for Files (and any Entity) Not Just Nodes

If you make a Files view a draggable view, with an integer field and using the FieldAPI handler, everything looks great except for this error:

Undefined property stdClass::$nid in draggableviews_handler_fieldapi->get() draggableviews_handler_fieldapi.inc

and the fact that it doesn't work at all.

Fortunately, the natural evolution of letting any Fieldable, Viewable entity be draggable has already taken its first step. See http://drupal.org/node/1264636 for the patch i'm trying out.

Unfortunately applying the code to my existing view kills it on preview, so i cannot edit my view to add the (i believe) necessary file ID as one of the fields on the view. I can start a new view however people should not get errors like this no matter what they do to their view...

Cannot access empty property in /home/ben/code/sdl/web/sites/all/modules/contrib/draggableviews/implementations/draggableviews_handler_fieldapi.inc on line 81
Call Stack:
0.0001     388120   1. {main}() /home/ben/code/sdl/web/index.php:0
0.4696   10126872   2. menu_execute_active_handler() /home/ben/code/sdl/web/index.php:21
0.4706   10183960   3. call_user_func_array() /home/ben/code/sdl/web/includes/menu.inc:503
0.4706   10184276   4. views_ui_build_preview() /home/ben/code/sdl/web/includes/menu.inc:0
0.5089   10351600   5. views_ui_preview() /home/ben/code/sdl/web/sites/all/modules/contrib/views/includes/admin.inc:926
0.7528   12655644   6. view->preview() /home/ben/code/sdl/web/sites/all/modules/contrib/views/includes/admin.inc:153
0.7655   12706384   7. views_plugin_display->preview() /home/ben/code/sdl/web/sites/all/modules/contrib/views/includes/view.inc:1116
0.7655   12706428   8. view->render() /home/ben/code/sdl/web/sites/all/modules/contrib/views/plugins/views_plugin_display.inc:2452
1.1827   13691552   9. draggableviews_views_pre_render() /home/ben/code/sdl/web/sites/all/modules/contrib/views/includes/view.inc:1012
1.1827   13691596  10. _draggableviews_info() /home/ben/code/sdl/web/sites/all/modules/contrib/draggableviews/draggableviews.module:320
1.1828   13699484  11. draggableviews_handler_fieldapi->get() /home/ben/code/sdl/web/sites/all/modules/contrib/draggableviews/draggableviews.inc:184

Telling it not to die over that:

<?php
      if (!isset($result->{$info['entity keys']['id']})) {
        debug('fail');
        return 0;
      }
?>

Causes a problem deeper in the stack:

Fatal error: Class name must be a valid object or a string in /home/ben/code/sdl/web/includes/common.inc on line 7487 Call Stack: 0.0005 331372 1. {main}() /home/ben/code/sdl/web/index.php:0 1.2996 11046848 2. menu_execute_active_handler() /home/ben/code/sdl/web/index.php:21 1.3058 11103524 3. call_user_func_array() /home/ben/code/sdl/web/includes/menu.inc:503 1.3059 11103840 4. views_ui_edit_page() /home/ben/code/sdl/web/includes/menu.inc:0 1.7185 14568552 5. views_ui_build_preview() /home/ben/code/sdl/web/sites/all/modules/contrib/views/includes/admin.inc:896 1.7248 14617584 6. views_ui_preview() /home/ben/code/sdl/web/sites/all/modules/contrib/views/includes/admin.inc:926 1.8340 14938016 7. view->preview() /home/ben/code/sdl/web/sites/all/modules/contrib/views/includes/admin.inc:153 1.8360 14940956 8. views_plugin_display->preview() /home/ben/code/sdl/web/sites/all/modules/contrib/views/includes/view.inc:1116 1.8360 14941000 9. view->render() /home/ben/code/sdl/web/sites/all/modules/contrib/views/plugins/views_plugin_display.inc:2452 3.3721 15884036 10. draggableviews_views_pre_render() /home/ben/code/sdl/web/sites/all/modules/contrib/views/includes/view.inc:1012 3.8624 16011220 11. _draggableviews_rebuild_hierarchy() /home/ben/code/sdl/web/sites/all/modules/contrib/draggableviews/draggableviews.module:369 4.7294 16117228 12. _draggableviews_save_hierarchy() /home/ben/code/sdl/web/sites/all/modules/contrib/draggableviews/draggableviews.inc:424 4.7295 16123916 13. draggableviews_handler_fieldapi->save() /home/ben/code/sdl/web/sites/all/modules/contrib/draggableviews/draggableviews.inc:806 4.7295 16124140 14. entity_load() /home/ben/code/sdl/web/sites/all/modules/contrib/draggableviews/implementations/draggableviews_handler_fieldapi.inc:18 4.7295 16124348 15. entity_get_controller() /home/ben/code/sdl/web/includes/common.inc:7454

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.