Hello guys,
We are now actively using your module and we found that it doesn't support entity properties for storing weights. We want developed entity property handler and want to share it with you. Please check it.

It can be used to process taxonomy weight property, but still has problems with other integer properties (because Entity Wrapper doesn't support setter callback for custom entity properties out of the box).

Comments

istryker’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new4.14 KB

This works. Attached is the file as a patch. I would like to add little more support before I commit this. IE other entities properties, hierarchy ('parent column/field', which is sorted in a separate table in database)

istryker’s picture

From [#/1716912]

Need to add file to draggableviews.info file:

+  files[] = handlers/draggableviews_handler_property.inc
istryker’s picture

I would like to get this into FieldAPI handler. For taxonomy handling see #1916380: Roadmap to add taxonomy support to module

jonmcl’s picture

I just gave this a try (on taxonomy terms) and it basically worked, except of course for lack of hierarchy.

One error I hit though: I have entities (from salsa_entity module) that don't have a base table defined. The module pulls entities from the cache (or from external service if cache is empty). Probably not exactly a kosher way of dealing with entities, but it might be a good idea to check the property before using it.

Line 95 of draggableviews_handler_property.inc, change from:

      if ($entity_info['base table'] == $view->base_table) {

.. to ..

      if (isset($entity_info['base table']) && $entity_info['base table'] == $view->base_table) {

Otherwise this addition looks promising. Theoretically it should work with any entity that has a weight property?

rudiedirkx’s picture

Issue summary: View changes

I like it!

Why isn't it in yet? Works perfectly with 2.0 even, which is over 2y old.

damienmckenna’s picture

Version: 7.x-2.0 » 7.x-2.x-dev
Status: Reviewed & tested by the community » Needs work

@iStryler: please don't mark your own patches as RTBC, especially when you change the status at the same time as you upload it - the patches have to be reviewed first.

Putting this back to Needs Work based on JonMcL's comment.

damienmckenna’s picture

Adding this to the 2.1 list as it seems to be almost finished.

PascalAnimateur’s picture

Re-rolled patch with suggestions from #4

istryker’s picture

I just looked at patch #1 yesterday. Again I like this approach. There is even a parent property, so I theoretically it is possible to do hierarchy with taxonomy. For example $entity_wrapper->parent = $item['parent'].

damienmckenna’s picture

Status: Needs work » Needs review
istryker’s picture

For this to get commit I want to get a handle of hierarchy property. We do not need to solve hierarchy property (we can create another ticket to solve it), but I want to have an understanding of how to solve it.

I have played around with taxonomy parent, and they put a spike in a simple solution. As I suggested in #9, $entity_wrapper->parent = $item['parent'] works for fixing non-taxonomy parents*. To add a parent to taxonomy you can do $entity_warpper->parent[] = $item['parent']. This adds a new parent, but does not delete/replace the old one. Taxonomies terms 1 to many parent ratio. The hierarchy taxonomy table does not have a unique id....all it has tid & parent. To delete/replace the old one, we would have to access X old value, add the new one then delete the old one.

* in addition to cloning draggableviews_handler_hierarchy_native to dragableviews_handler_hierarchy_property.

rudiedirkx’s picture

I've never understoond how taxonomy can have multiple parents. The db and object structure supports it, but the UI doesn't, and I've never seen an example. I don't think anyone uses it, because no contrib uses it. If you know of examples, please share.

rudiedirkx’s picture

I also don't understand how you would sort hierarchical taxonomy with this... I can't even make a view that looks like a taxonomy tree. Weights are too weird. It is super useful for custom tables though. I use it to order registrations in a waitinglist. Works like a charm.

PascalAnimateur’s picture

@rudiedirkx you might want to take a look at the views_tree module.

rudiedirkx’s picture

StatusFileSize
new4.99 KB

Reroll of #8 against current dev.

rudiedirkx’s picture

New patch. Works for non-base-table too. And doesn't use entity metadata to save.

rudiedirkx’s picture

StatusFileSize
new4.65 KB

And a patch against 2.1 for my make file.

nwom’s picture

Please take a look at #1916168: Taxonomy Term Weight & Hierarchy support submodule. It appears to be more feature complete and works automatically with taxonomy's native weight and hierarchy.

rudiedirkx’s picture

This issue is not just about taxonomy. It's about any column in any base table.

I don't know what "feature complete" means... This patch seems done to me. It can save weight into any column in any base table.

nwom’s picture

Oh my mistake. I must have mixed it up with another issue. There were a few taxonomy hierarchy and weight issues open.

rudiedirkx’s picture

Title: Property drag handler (taxonomy weight) » Drag handler for saving weight into any column in any base table

Title was not perfect. This is better.