Hi everyone!

I am trying to link the image to the node, it sounds simple, but I can't figure it out. It's the first time I use this module. There should be an option like: link to node.

I can see the other options, such as Styles, Alt, Title, but I am unable to link the image(s) to the node.

I need some guidance.

Thank you!

Comments

hectorplus’s picture

Category: Support request » Feature request
shadowxx’s picture

I'm also looking for that feature ;)

davidneedham’s picture

Version: 7.x-1.3 » 7.x-1.x-dev

This may be obvious, but you'll have to link the image manually after inserting it. If you're creating a new node and you don't know what the URL is going to be, you may have to save the node first, copy the URL, and then create the link on the image.

Annoying, but I personally don't think it's something that should be within the insert module itself. Still, patches welcome. If you (or anyone happening across this) adds the functionality to make it work, post here so others can benefit.

snater’s picture

I am browsing trough old issues while working on the module's D8 version. First I thought about picking this up for D8, but then again, I am not really convinced.

It would very well be possible to have Insert insert a placeholder link that is replaced when processing the node form. But that would require an option right next to the Insert button whether to Insert the image with a link to the node or without, as probably not all images shall link to the node. I think the relatively rare use-case of linking an image to the node does not justify always having an option in such a prominent place. So, one could argue about having a field setting on whether to include that option at the Insert button, but an option whether to allow setting an option just does not seem right…

Another solution would be to have a sub-module duplicating each existing style with the same style, but the duplicated style's template including the placeholder link. (This would be similar to how the colorbox module extends Insert.) But I think this would tend to create a messy style list for such a small feature.

Regardless, it is possible to solve that with a custom module providing a custom style to Insert. A custom module would need to implement hook_insert_styles to provide the style label and hook_insert_content that would aggregate and return the template generated for that style. An example of such hook implementations can be seen in insert/includes/insert.inc. The custom style would insert a placeholder link through its own template. Hooks like hook_node_insert and hook_node_update could be used to replace the placeholder.
It would of course also be possible to implement the custom module in the way the colorbox module does, as described above.

Since I am not convinced of that being a major use-case, I will close the issue as "works as designed", unless any objection arises.

snater’s picture

Status: Active » Closed (works as designed)

As per last comment.