function url_field_prepare_view in URL field 7
Same name and namespace in other branches
- 8 url.module \url_field_prepare_view()
Implements hook_field_prepare_view().
File
- ./
url.module, line 214 - Provides a URL field type that stores external links with optional titles.
Code
function url_field_prepare_view($entity_type, $entities, $field, $instances, $langcode, &$items) {
foreach ($entities as $id => $entity) {
foreach ($items[$id] as $delta => &$item) {
// Split out the link into the parts required for url(): path and options.
$parsed = drupal_parse_url($item['value']);
$item['path'] = $parsed['path'];
$item['options'] = array(
'query' => $parsed['query'],
'fragment' => $parsed['fragment'],
'attributes' => &$item['attributes'],
);
}
}
}