I have just downloaded the newest version, and was pleased to see many things having been addressed. However the Link -> Go To URL does not work.

I had a look and found the problem.

In function theme_img_assist_inline the following line:

$output .= l($img_tag, $attributes['url'], array(), NULL, NULL, FALSE, TRUE);

should read as:

$output .= l($img_tag, $link[1], array(), NULL, NULL, FALSE, TRUE);

There is no 'url' attribute, and the second element of $link can be used.

This is working for me with internal and external URLs.

Thanks for the good work.

Comments

zoo33’s picture

Just to double check, are you using Drupal 4.7 and Image assist 4.7-1.x-dev?

sun’s picture

Version: 4.7.x-1.x-dev » 5.x-1.x-dev
Assigned: Unassigned » sun
Status: Active » Patch (to be ported)
StatusFileSize
new0 bytes

It's true - $attributes['url'] is not set. Committed attached patch for 4.7.

However, the same bug exists in 5.x, but I'd like to find a cleaner solution for this issue there. I'll dive a bit into TinyMCE allowed tag attributes, since I'd like to turn link=url,http://example.com into link=url|url=http://example.com. This is badly needed for http://drupal.org/node/176157 so we can define any link type and independently assign an url.

darrenlambert’s picture

Sorry, yes I'm using Drupal 4.7 and Image assist 4.7-1.x-dev

sun’s picture

StatusFileSize
new9.86 KB

Attached patch converts the link=url,foo attribute to link=url|url=foo.

From my own testing I can say this is working. However, since existing tags are not updated (unless edited via TinyMCE *if* TinyMCE plugin is used at all), we need to update existing contents or we will need to have backwards compatible code in Img_Assist forever.

sun’s picture

Priority: Normal » Critical
Status: Patch (to be ported) » Needs review
StatusFileSize
new13.18 KB

After discussing this with smk-ka, it seems that there is yet no way to implement an update converting all old tags into new ones.

Thus, revised patch adds backward compatibility including a tag attribute conversion in the TinyMCE plugin.

Tested with both TinyMCE and regular textareas.

smk-ka’s picture

A few notes:

  • .split(','); should read .split(',', 2); at several locations (because ',' could also occur as part of the url)
  • You're saving the image's default url in a hidden field, and don't add the entered url to the piped argument list if it matches the default value, so far so good. However, there seems to be no code that (upon display) sets the default url if no url attribute was given. In this case $attributes['url'] is unset, so you're additionally generating an E_NOTICE error.
smk-ka’s picture

Status: Needs review » Needs work
sun’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new13.23 KB

Thanks for reviewing! Committed attached patch to DRUPAL-5.

sun’s picture

Status: Reviewed & tested by the community » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)