I checked out the code and I miss a way to add nodes to the collection node via ajax or a simple form. Suppose a user is on a node page and he wishes to add the node to one of his collections, a form block would be convenient which could optionally submit it via ajax.

Is this something you would consider for this module? Or perhaps as a contrib for this module?

Comments

xen’s picture

Status: Active » Postponed

I can see how it could be useful, however, it's not easy to implement in any way proper.

For instance, say that the node_reference field is set to use a view for validation, there's no way for the block to determine whether the node that the user is looking at, is one that is part of that view, so the block might insert a reference to a node that's not allowed by the field. And I'm not sure it's possible to run the widget validation outside the node form.

But if you really need it, it's not that difficult to use collection_field_name() to find out what the field name is on the collection, adding the nid, and saving the node.

toemaz’s picture

Hi Xen,

Thanks for the quick reply and good catch concerning the view validation.

Before I will go ahead and try to make this contrib module, I was wondering, do you know about modules who do similar things like your collection module does? I have been looking for a module which let users make collections of nodes and arrange them in order. Just like Youtube playlist functionality sort of speak. Seems like your module is the first one coming close to match my specific needs.

xen’s picture

You might want to check out nodequeue and nodefamily. That two modules I can think of that deals with node relations, but in very different ways. It depends entirely on what you want to do precisely, whether you need a node for the collection, do you need any number of collections per user, etc.

xen’s picture

Status: Postponed » Closed (won't fix)
henrijs.seso’s picture

Title: Ajax way to add node references » Way to add node to collection from node itself
Category: support » feature
Status: Closed (won't fix) » Active

I would like to see this feature implemented. Many use cases have foreseeable configurations, for example, collection nodes can be made by any user and he is allowed to add any published node to collection. It would be so simple to provide block with a list of user created collections on collectible nodes. User could just click on collection to add node to it.

xen’s picture

Status: Active » Postponed (maintainer needs more info)

As I've already said, it sounds simple, but it isn't.

Say I've defined a collection type with a field that's to only allow 'story' nodes to be referenced. How do I up front know whether any given node would be allowed or not? It might sound like an easy thing, but consider it also might be a view that have 10 different filters. Nevermind the performance impact, there's really no way to do it generally. Someone might make a new nodereference field tomorrow that allows or denies adding of nodes on entirely different criteria. I can't remember if widgets might be able to look at the whole node, but if that's the case, we'd have to run the validation on every possible collection node.

If someone comes up with something that works decently, I might consider including it as a add-on module. But I don't see it as becoming part of Collection.

toemaz’s picture

I think I agree with Xen that the requested use case can be generally implemented in this module. Instead, I would create a contrib module which hooks into this module as a sort of API.

jeffam’s picture

Issue summary: View changes
Status: Postponed (maintainer needs more info) » Closed (outdated)