function term_level_field_settings_levels_validate in Term Level Field 7
Validates that level settings are correct.
1 string reference to 'term_level_field_settings_levels_validate'
- term_level_field_settings_form in ./
term_level.module - Implements hook_field_settings_form().
File
- ./
term_level.module, line 199 - Field type for referencing terms with a level to an entity.
Code
function term_level_field_settings_levels_validate($element, &$form_state) {
$levels = _term_level_extract_levels($element['#value']);
if (count($levels) == 0) {
form_error($element, t('Please enter valid levels.'));
}
foreach ($levels as $key => $label) {
if (!is_numeric($key)) {
form_error($element, t('The level key must be numeric.'));
}
}
}