You are here

function url_field_formatter_prepare_view in URL field 8

Same name and namespace in other branches
  1. 7 url.module \url_field_formatter_prepare_view()

Implements hook_field_formatter_prepare_view().

File

./url.module, line 274
Provides a URL field type that stores external links with optional titles.

Code

function url_field_formatter_prepare_view($entity_type, $entities, $field, $instances, $langcode, &$items, $displays) {
  foreach ($entities as $id => $entity) {
    $settings = $displays[$id]['settings'];
    foreach ($items[$id] as $delta => &$item) {

      // If the formatter is configured to add rel="nofollow" to links, then
      // add them here.
      if (!empty($settings['nofollow'])) {
        $item['options']['attributes']['rel'] = 'nofollow';
      }
    }
  }
}