I have simple CCK 'Member' with integer 'Age' field, and I check revision option on so each modification for Member node, will have revisions. I use views and make 'Age' field editable (AJAX).

I found out that when I modify one of row from views, no revision is made.

I made a small line to file: editablefields.module line 318, adding line $node->revision = 1;, here's the snippet code..

if ($node->{$field_name}[$delta] != $form_state['values'][$field_name][0]) {
  $node->{$field_name}[$delta] = $form_state['values'][$field_name][0];
  $node->revision = 1; //there should be a mechanism to check whether this node-type uses revision.
  node_save($node);
}

Now. the revision is made correctly when I modify from views.

CommentFileSizeAuthor
#7 editablefields-1189196-7.patch637 bytesmwsam
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

vulzan’s picture

I too had the same issue and was going crazy trying to figure this out. I added the code you list above. Rebooted my server (just cuz that's how I roll), changed the editability in my view to not editable and saved. Changed it back again to editable using AJAX and saved. Cleared Drupal caches (Drupal cache and views cache) and my my browser cache, and still, no new version is saved when changing the field value in views. It creates a new version on the node/edit form, of course, but not in views. I am using Drupal 6.20, editablefields version 6.x-2.0, revisioning version 6.x-3.11, and views 6.x-2.12. Any ideas besides upgrading everything? I have a ton of modules installed ... and I mean a ton.

tannerjfco’s picture

Version: 6.x-2.0 » 7.x-1.0-alpha2

Just noticed this is also an issue with the 7.x version. Fields edited using editable fields do not track a revision when "create new revision" is set on the node, though normal editing from the node will track the revision.

nooysters’s picture

Yes having this issue with the 7 version. Is there a quick fix like the 6 version? ex. $node->revision = 1; Looking at the module file but cannot see where a similar fix would go.

invisibleink’s picture

This seems to be a result of the Entity API not supporting revisions. Since editable_fields uses Entity API for loading and saving, it seems that the field system is not getting the revision property from the node.

While the nice folks over at Entity API are working on Support revisions in Entity API, maybe someone with a better understanding of this module could figure out a way to use a different load and save for entities that are actually nodes?

I tried using the 7x-1.x-dev of Entity module, and applying the patch from #20 of the above issue, but saw no affect....either on the behavior of editable_fields revision saving, or on the properties that were getting loaded.

Apologies if I've totally misunderstood the problem...just following a trail, and hoping for help making this work!

dtarc’s picture

It seems that hook_node_save() never gets called when editing fields via views (and maybe other places, we are only using it in views).

It seems very odd, Because I would've thought entity_save() would call node_save().

We discovered the issue because we wanted to trigger changes in other fields when a change was made to the editable field and we couldn't do it in node_save() strangely.

presleyd’s picture

I issued a bounty for these issues:

#1405854: Multiple fields not saved
#1206656: Error on Node view page: Argument 1 passed to drupal_array_get_nested_value()
#1189196: Doesn't create revision on content-type which revision option is checked.

and I think #1449750: Title field does not save changes (I'm not 100% sure if I understood the problem here but took it to just be problems saving from Views displays which I need but didn't test if it worked previously)

Mwsam has produced fixes, once I finish my tests tomorrow (so I can pay him) he'll post patches here.

mwsam’s picture

Status: Active » Needs review
FileSize
637 bytes

Here is a patch against the latest 7.x-1.x branch. This the fork I used when I'm working on multiple issues of editablefields: https://github.com/mwsam/editablefields

drjonez’s picture

The above patch appears to work fine, though it seems that it slows down the "saving" of content. That's a minor consequence. It might be nice to have an option in the view field to turn on or off saving of revisions, but this gets us to where we need to be.

At any rate, thanks for this, it really helps!

NWOM’s picture

Thanks a lot for the patch. It still works perfectly!

dags’s picture

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

Fixed in 7.x-1.x-dev. Thanks for the patch @mwsam!

As a consequence of this patch, if a user is making several field-level revisions on an editable form, then we end up with a bunch of small revisions as opposed to one big revision like we'd get when using a regular node/edit form. Not really an issue, just something to think about...

Status: Fixed » Closed (fixed)

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