function _patterns_io_import_check_name in Patterns 7.2
Same name and namespace in other branches
- 7 includes/io/import.inc \_patterns_io_import_check_name()
Helper function to be called in one of the import validation handlers.
File
- includes/
io/ import.inc, line 53 - Importing Patterns from a file or using an URL.
Code
function _patterns_io_import_check_name($name = '') {
// Name Validation.
$errors_on_name = _patterns_parser_analyze_pattern_name($name);
if (!empty($errors_on_name)) {
form_set_error('name', t('Errors in the name of the pattern: ' . implode(', ', $errors_on_name)));
// TODO: use proper t()
return FALSE;
}
if ($obj = patterns_db_load_pattern_from_name($name)) {
form_set_error('name', t('A pattern file with the same name already exists: !name', array(
'!name' => $name,
)));
return FALSE;
}
}