function _link_widget_process in Link 5
1 call to _link_widget_process()
- link_widget in ./
link.module - Implementation of hook_widget().
File
- ./
link.module, line 448 - Defines simple link field types.
Code
function _link_widget_process(&$item, $delta = 0, $field, $node) {
// Remove the target attribute if not selected.
if (!$item['attributes']['target'] || $item['attributes']['target'] == "default") {
unset($item['attributes']['target']);
}
// Trim whitespace from URL.
$item['url'] = trim($item['url']);
// Serialize the attributes array.
$item['attributes'] = serialize($item['attributes']);
// Don't save an invalid default value (e.g. 'http://').
if (isset($field['widget']['default_value'][$delta]['url']) && $item['url'] == $field['widget']['default_value'][$delta]['url'] && is_object($node)) {
if (!link_validate_url($item['url'])) {
unset($item['url']);
}
}
}