What's the correct way to add attributes to a Link field? So I'm preprocessing a field: preprocess_field and trying to add attributes to a Link. I've tried:


      $variables['items'][0]['attributes']['target'] = '_blank';
      $variables['attributes']['target'] = '_blank';
      $variables['#attributes']['target'] = '_blank';
      $variables['content_attributes']['target'] = '_blank';
      $variables['content_attributes']['attributes']['target'] = '_blank';
      $variables['items'][0]['#attributes']['target'] = '_blank';
      $variables['items'][0]['options']['attributes']['target'] = '_blank';
      $variables['items'][0]['#options']['attributes']['target'] = '_blank';
      $variables['items'][0]['#options']['target'] = '_blank';
      $variables['items'][0]['#content']['#options']['attributes']['target'] = '_blank';
      $variables['items'][0]['#content']['options']['attributes']['target'] = '_blank';
      $variables['items'][0]['#options']['attributes']['target'] = '_blank';


A silly amount of attempts, none of these worked. How can I add attributes to a link?
There were some close ones, but this is the correct way to set an attribute to the first link:

function mymodule_preprocess_field(&amp;$variables) {
  if ($variables['field_type'] == 'link') {
    $variables['items']['0']['content']['#attributes']['target'] = '_blank';
  }
}