function phantomjs_capture_field_validate in PhantomJS Capture 7
Field validator that ensure that a url was given.
1 string reference to 'phantomjs_capture_field_validate'
- phantomjs_capture_field_field_widget_form in phantomjs_capture_field/
phantomjs_capture_field.module - Implements hook_field_widget_form().
File
- phantomjs_capture_field/
phantomjs_capture_field.module, line 189 - Implements a new field that takes usages of the PhantomJS capture module to allow users to enter an URL and display the screen shot captured as an image on the entity.
Code
function phantomjs_capture_field_validate($element, &$form_state) {
if (!empty($element['#value']) && !valid_url($element['#value'])) {
form_error($element, t("Needs to be a valid URL."));
}
}