It appears that captions are stripped of all html tags, with the result that it's impossible to provide a link (to a high-resolution version of the image, in my case). For a very simple example, if you put link into a custom caption, it is rendered as the word "link", with no link tag. In my case, I used a pre_render function to add the link html to an image field as follows:
foreach($view->result as $key => $row) { if(isset($row->field_field_highresimage[0])) { $url = render(file_create_url($row->field_field_highresimage[0]['raw']['uri'])); $markup = '<a href="'.$url.'" target="_blank">download high-resolution image</a>'; // add the markup to the colorbox_custom_caption for the regular image field (which is displayed in a colorbox) $view->result[$key]->field_field_image[0]['rendered']['#display_settings']['colorbox_caption_custom'] = $markup; } }
but it is rendered just as the text "download high-resolution image", no link.
Presumably somewhere downstream of this, a strip_tags() call is made, but I have no idea where.
Comments
Comment #1
kmadel commentedYou need to modify the settings of the field you are using as the caption to use 'Filtered text' instead of 'Plain text.'
Comment #1.0
kmadel commentedclarification