On my field settings, I have Search, add, and edit checked, and I have created a view for the search dialog. Both the Search and Add buttons show up on my node edit page, but there is not an Edit button. Is that not yet functional, or am I missing something?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

andylhansen’s picture

Category: support » feature

After messing around with it some more, I found that you first have to save the node form in order for the "Edit" link to appear. So I'd like to change this to a feature request that on a create node page, that once you have selected a node for a node reference field, that the edit link will appear on the form.

fabsor’s picture

I completely agree. I will get to work on this as soon as possible.

webankit’s picture

This feature will be gr8,
Beside this, on clicking edit a reference, Node Page open.
It will be gr8 if the path of editing that node open directly.

grndlvl’s picture

Title: Is Editing a node supported yet? » Edit links does not display until after the node is saved.
ejustice’s picture

I'd find this useful.

Also I think it would be helpful if the create link was removed if an entity/node/user has been entered into the field. This would help prevent confusion on the users' part when using this in an unlimited setting (the fact that you need to click add another item then create in the new row. Also it would be helpful in preventing overwriting values that have already been entered in the field.

I don't know if you want this as a separate feature request as I see them being linked, but others may not.

imclean’s picture

I've addressed both the original request and the one by ejustice in #5 in another issue:

#1774466: References Dialog UI improvements - contextual create and edit links, hide input option

imclean’s picture

This uses ajax to replace the create link with an Edit link if the user has update permissions.

It doesn't yet check the widget settings to see if the Edit operation is enabled. This is an essential function but I've run out of time right now. Uploading anyway in case anyone wants to have a go.

imclean’s picture

Current issues with #7:

- Doesn't check Widget Settings for Edit operation
- Resets when "Add another item" is clicked
- Permission check not correct for all entity types. Only really tested with nodes but should work with entities.

It replaces the Create link so effectively deals with #5.

imclean’s picture

Status: Active » Needs work

I'm working on a more robust solution.

imclean’s picture

Status: Needs work » Needs review
FileSize
4.76 KB

Try this one.

imclean’s picture

Just a note on permission checking: the above uses entity_access() from the Entity API module. This, from my novice understanding of entities, should pass the request on to the appropriate access callback for that entity.

imclean’s picture

phoenix’s picture

Status: Needs review » Needs work

Thanks for the patch. It adds the edit link now, but edit or create aren't opened in a dialog anymore. I guess you introduced a javascript bug.
In my console I see this: "Uncaught TypeError: Cannot read property '2' of null "
Is this error coming from this part?
Drupal.ReferencesDialog.ajaxEdit(key, matches[2], matches[3]);
It's the only new part where you want to get property 2. Now looking why matches is null.

I tried some console.log().
- console.log($('#' + key).val());
Returns the values from the autocomplete entity reference field (eg. "title (34)").
- console.log(matches);
Returns "null".

I guess there's something wrong with the regex in this part:

var matches = $('#' + key).val().match(/^(?:\s*|(.*) )?\[\s*(.*)\s*:\s*(\d+)\s*\]$/);
imclean’s picture

Hmm...it works on node/edit for me but not node/add.

Won't be able to look at this for a little while but it does need fixing.

rogical’s picture

Status: Needs work » Active

Using js is somehow not very stable, I've added an ajax callback to automatically refresh the widget, add link would be removed edit link would display then. I'll add this feature to references dialog after more testing.

http://drupal.org/sandbox/rogical/1880826 References Thumbnail

DamienMcKenna’s picture

Pardon me for jumping into this issue, but shouldn't all of the logic managing the links be handled via JS? Collaborating on #1774466: References Dialog UI improvements - contextual create and edit links, hide input option would be the best solution as there are several related problems that should be fixed together.

geophysicist’s picture

Here is my js fix. I just change create link to edit link when popup closes.

sanchiz’s picture

Status: Active » Needs review
FileSize
738 bytes

Updated patch #17 to include base_path.

Status: Needs review » Needs work

The last submitted patch, 18: references_dialog_edit_link-1257808-18.patch, failed testing.

VasyOK’s picture

Thanks, #17 work's for me!

GDrupal’s picture

Version: 7.x-1.0-alpha1 » 7.x-1.x-dev
Status: Needs work » Needs review
FileSize
2.52 KB

I have been working on a UI tweaks for this. It adds a little extra feature to update the edit link on each reference change.

igorik’s picture

#17 works for me, #21 doesn't work for me.

However, I would prefer to add this option:
While I found in autocomplete suitable node, so I don't need to use dialog in lightbox, after chosing the option in autocomplete, the link "Edit" could be added next to "+ Create"
So it could be possible to edit chosen option, or create new one.

jay.lee.bio’s picture

Just like @igorik, #17 also works for me but #21 doesn't.

I also want to take #22 further, because there's an inconsistent user interface issue that's potentially confusing:

1) I think "Edit" from #17 should say "Edit Content Type" to match "Create Content Type".

2) I also think "Edit" that displays after node is saved should say "Edit Content Type".

3) I also think "Edit" ("Edit Content Type") from #17 should not replace "Create Content Type" but instead be added to it (to the left, just like how it's displayed after node is saved).

4) Per #22, "Edit" ("Edit Content Type") should be added to the left of "Create Content Type" when the Autocomplete option is used instead of "Create Content Type".

5) If I decide to reference another node on 4), update "Edit" ("Edit Content Type"). I believe this is what #21 is trying to do, but I created a separate issue for it because I believe it's a different although related bug that should be taken care of on its own page.