function quotes_blocks_settings_validate in Quotes 6
Same name and namespace in other branches
- 7 quotes.admin.inc \quotes_blocks_settings_validate()
Validates that the new block name is valid.
File
- ./
quotes.admin.inc, line 286 - The quotes module allows users to maintain a list of quotes that can be displayed in any number of administrator-defined quote blocks.
Code
function quotes_blocks_settings_validate($form, &$form_state) {
$name = trim($form_state['values']['name']);
if (!$name) {
form_set_error('name', t('You must specify a valid block name.'));
}
else {
if (db_result(db_query("SELECT COUNT(*) FROM {quotes_blocks} qb WHERE qb.name = '%s'", $name))) {
form_set_error('name', t('The block name %name already exists. Please choose another block name.', array(
'%name' => $name,
)));
}
}
}