When I click in any upload image it show:

This image was uploaded with the post title bla bla bla.
parent post: title bla bla bla

It's possible hide tags?

I try fix it in upload_image.module
'title' => t('parent post: %title', array('%title' => check_plain($image->title))),

but don't work

examples:
http://www.mtbcampogib.com/taxonomy/term/36
http://lviv.ridne.net/taxonomy_menu/2/99/55
http://www.brasilapicola.com.br/node/177
thanks

Comments

Wounded Knee’s picture

This image was uploaded with the post title bla bla bla.
parent post: < em >title bla bla bla< /em >

It's possible hide < em > tags?

santiajo’s picture

In upload_image_link change:

      $links['upload_image_link'] = array(
        'title' => t('parent post: %title', array('%title' => check_plain($image->title))),
        'href' => 'node/'. $image->oid,
        'attributes' => array('title' => t('Read parent post to view all attached images.'), 'html' => TRUE),
      );

to:

      $links['upload_image_link'] = array(
        'title' => t('parent post: %title', array('%title' => $image->title)),
        'href' => 'node/'. $image->oid,
        'attributes' => array('title' => t('Read parent post to view all attached images.')),
        'html' => TRUE,
      );
ansorg’s picture

Status: Active » Needs work
StatusFileSize
new990 bytes

no, this does not work - at least not with the Drupal-6 version.

reason is that the <em> does not get added by the check_plain() function but by the t() function when the variable is specified with %

I do not know whether it is possible to get a proper <em> into this but a working fix to get rid of the "fake" <em> is

'title' => t('parent post: @title', array('@title' => $image->title)),
 

the @-prefix ensures that text is escaped, therefore the check_plain is not needed. See http://api.drupal.org/api/function/t

I attach a patch that does change this line in upload_image.module. This is tested with D6 but from reading the t() documentation it should also work against D5

Jens

CoolDreamZ’s picture

I can confirm that this solution works in Drupal 5

ansorg’s picture

Great, thanks.

Hello maintainer. any chance getting this into the codebase?

john morahan’s picture

Version: 5.x-1.1 » 5.x-1.x-dev
Status: Needs work » Reviewed & tested by the community
StatusFileSize
new1.09 KB

Actually santiajo's change in #2 is more correct because #3 does not fix the misplaced 'html' => TRUE and so the title is still double escaped (note that right now it's triple escaped, so this is still an improvement!). So for example if the title was tom & jerry it would display as tom &amp; jerry.

If you want to use the <em> tags correctly, as opposed to removing them completely, then #2 is the correct approach. If you wanted to remove them completely, #3 is closer but you would need to either move the 'html' => TRUE to the correct place as in #2, or remove it altogether and change % to !, allowing the l function to do the escaping later.

In either case, the explicit check_plain definitely needs to go.

Attaching santiajo's suggestion as a patch and marking RTBC for 5.x - I haven't tested 6.x but going by the documentation for hook_link the same change should work there.

killes@www.drop.org’s picture

Status: Reviewed & tested by the community » Fixed

applied, thanks!

Status: Fixed » Closed (fixed)

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