function nd_build_mode_form_validate in Node displays 6
Validate new custom display submission.
File
- includes/
nd.buildmodes.inc, line 226 - Manage build modes.
Code
function nd_build_mode_form_validate($form, &$form_state) {
if ($form['#form_type'] == 'insert') {
$existing = array_keys(nd_get_build_modes());
if (in_array($form_state['values']['key'], $existing)) {
form_set_error('key', t('This display mode already exists.'));
}
if (!preg_match('!^[a-z_]+$!', $form_state['values']['key'])) {
form_set_error('key', t('The machine-readable name must contain only lowercase letters and underscores.'));
}
}
}