You are here

function _html5_tools_link_field_process in HTML5 Tools 7

Link fields process function to modified the regular 'text' input field to a 'url' input type.

1 string reference to '_html5_tools_link_field_process'
html5_tools_element_info_alter in ./html5_tools.module
Implements hook_element_info_alter().

File

./html5_tools.module, line 33

Code

function _html5_tools_link_field_process($element, $form_state, $complete_form) {
  $instance = field_widget_instance($element, $form_state);

  // Lets make sure the urlwidget widget is selected.
  if (!empty($instance['widget']['type']) && $instance['widget']['type'] == 'urlwidget') {

    // If so, then lets switch the tyle to a urlfield.
    $element['url']['#type'] = 'urlfield';
  }
  return $element;
}