1 link.module | link_field_settings_form_validate($element, &$form_state, $complete_form) |
#element_validate handler for link_field_instance_settings_form().
File
- core/
modules/ link/ link.module, line 237 - Defines simple link field types.
Code
function link_field_settings_form_validate($element, &$form_state, $complete_form) {
if ($form_state['values']['instance']['settings']['title'] === 'value' && empty($form_state['values']['instance']['settings']['title_value'])) {
form_set_error('title_value', t('A default title must be provided if the title is a static value.'));
}
if (!empty($form_state['values']['instance']['settings']['display']['url_cutoff']) && !is_numeric($form_state['values']['instance']['settings']['display']['url_cutoff'])) {
form_set_error('display', t('URL Display Cutoff value must be numeric.'));
}
if (empty($form_state['values']['instance']['settings']['title_maxlength'])) {
form_set_value($element['title_maxlength'], '128', $form_state);
}
elseif (!is_numeric($form_state['values']['instance']['settings']['title_maxlength'])) {
form_set_error('title_maxlength', t('The max length of the link title must be numeric.'));
}
elseif ($form_state['values']['instance']['settings']['title_maxlength'] > 255) {
form_set_error('title_maxlength', t('The max length of the link title cannot be greater than 255 characters.'));
}
}