0

I have a text field that turns its value into a link, provided it's an absolute link. For some reason, setting the target to blank is not working. Am I doing something wrong? I set the target inside the array.

elseif (valid_url($row->{$view->field['field_myDoc_link_value']->field_alias}, TRUE)) {
  $fields['title']->content = l(
    $fields['title']->content,
    $row->{$view->field['field_myDoc_link_value']->field_alias},
    array('target'=>'_blank', 'html' => TRUE)
  );
}

Or would I set it somewhere else? Thanks!

2

Your problem is that you need to define the target under attributes, so

array('target'=>'_blank', 'html' => TRUE)

should instead be:

array('attributes' => array('target' => '_blank'), 'html' => TRUE)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.