Link won't open in a new window

jonigual - October 23, 2009 - 11:21
Project:Link
Version:6.x-2.6
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Issue tags:new window, target, _blank
Description

It happens when I configured the link field's target to "Allow the user to choose". When the user creates a link for the first time, and checks the "Open URL in a New Window" checkbox, the first time I view the page, the link does open in a new window. But when I refresh the page, just pressing F5, the link doesn't open in a new window any more. If I edit the node (the "Open URL in a New Window" is still checked), and save it again, without changing anything, the link will open in a new window again, until I refresh the page, just like before.

I looked into the code in link.module, and I think I found what is causing the problem, although I don't know why. In the "_link_sanitize" function, the $item['attributes'] is an array, where $item['attributes']['target'] is set to "_blank". But when refreshing the page, $item['attributes'] is not an array any more, instead it has an string with the value "a:1:{s:6:"target";s:6:"_blank";}". I'm not sure what it means, it looks like the internal signature of the Array, but php does not recognize it as an Array object any more.

I attach here the link.module file with a temporal workaround I used to handle this. It's quite ugly, but I'm a beginner in module development, and I don't fully understand how it all works.

AttachmentSize
link.module.txt25.57 KB

#1

dropcube - November 5, 2009 - 04:52
Status:active» fixed

Could you please test the current dev version and re-open the issue continues. Thanks.

#2

jonigual - November 10, 2009 - 11:06

Hi, I tested the current dev version and it all works fine. Thanks.

#3

System Message - November 24, 2009 - 11:10
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.