Problem/Motivation
Trying to get the auto save feature to work for nodes and other content types. First I tried the autosave module, but soon after that I discovered that it does not work properly with Drupal 7.12. Then I stumbled uppon node_autosave and it works great for the article content type but not for others. Unfortunately I need it to work for other content types as well for this project.
It seems due to the fact that there is a token in the form on the article page (it has tags which do ajax when one starts typing a tag), but other nodes don't seem to have that.
Also, I get this error when changing the content type to have a taxonomic field:
Notice: Trying to get property of non-object in node_autosave_field_widget_properties_node_alter() (line 242 of /home/boosted/drupal-boosted/sites/all/modules/custom/node_autosave/node_autosave.module).
Proposed resolution
Generate a drupal token to pass back and forth from the node's form via AJAX in any case. Since the article node has tags, it seems to do that automatically but not for other node types. I tried including the js by force but that does not seem to be enough.
Remaining tasks
Pass the token and handle it properly.
User interface changes
UI is good!
API changes
API is good.
You can see the problem at http://boosted.alphageek.net.nz/dev/node/add/artist-page.
Login:
artist / password
You can also see that it's working for Article there.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | node_autosave.js_.patch | 805 bytes | geek.de.nz |
Comments
Comment #1
zhgenti commentedHi,
Thanks for the bug report. I've committed a fix which solves the issue with forms not containing ajax elements. When some form contains ajax-driven elements Drupal automatically adds required JS files and $form_state['cache'] = TRUE; But as long as basic forms for new content types don't contain any ajax elements, it wasn't worked correctly.
Module needs to be refactored in order to use AJAX-framework, but I think it will be done a later stages. together with changes required to work with any drupal entity instead of just nodes. For now this fix should solve the problem.
Please have a try and let me know if it works for you.
Cheers,
Dmitry
Comment #2
geek.de.nz commentedHi Dmitry,
Great! You fixed it. Really good! Attached you can find a patch that will make it work with the CKEditor. I know it would be better to make it work with the whole of the WYSIWYG module, but it's a start. For me this is satisfactory at the moment.
Cheers,
Tim