Hello,

Thank you for this module. I just installed it today and was toying with it and I believe I came across a minor bug.

I have a content type whose type field consists of an underscore (i.e., test_content). Drupal converts this in the URL to test-content, however when Draft pulls the content it's using node type and it pulls in the underscore format.

This causes problems when viewing a saved draft in draft/list:

VIEW link points to: node/add/test_content?draft_id=3
Drupal expects: node/add/test-content?draft_id=3

So this consistently bounces me into the generic content creation page since Drupal doesn't know what test_content is.

This is minor in that I'll just tweak my content types to not have any spaces, therefore removing the need to an underscore, but thought that I would bring this up in case someone else comes across the problems.

Thanks again for the mod!

Comments

jclaussen’s picture

Thank you for posting this issue. Saved me alot of time.

darren.ferguson’s picture

Thanks for the bug update, will address this issue in the coming days and put the fix into the nightly dev build.

nquocbao’s picture

I will update it here http://drupal.org/node/368030 :-D

darren.ferguson’s picture

We have created this and i will put online hopefully today

adshill’s picture

Was this updated? I've updated to the dev version and the problem still exists. Any chance of an update? :)

Thanks a lot,

Adam

adshill’s picture

If I have worked this out its a major achievement for me as I don't know php at all... (I know I shouldn't get excited but... it feels good to contribute instead of always asking :)

Anyway... correct me (pleease!) if I'm wrong, but the fix is in line 18 of draft_views_handler_field_draft_view.inc

You need to replace:

$output = l(t('View'), 'node/add/'. $values->drafts_node_type, array('query' => array('draft_id' => $values->drafts_draft_id)));

With this,

$output = l(t('View'), 'node/add/'. str_replace('_', '-', $values->drafts_node_type), array('query' => array('draft_id' => $values->drafts_draft_id)));

Seems to work for me anyway. Sorry I couldn't submit a patch but I don't know how to use patching yet so... one step at a time!!

Adam

geodaniel’s picture

Status: Active » Needs review

It looks like that's the way this is handled in core as well ($type_url_str = str_replace('_', '-', $type->type); on line 21 of modules/node/content_types.inc), so that's probably sensible.

darren.ferguson’s picture

Status: Needs review » Fixed

This is now handled in the version that is in CVS.
Closing this issue.

darren.ferguson’s picture

Status: Fixed » Closed (fixed)