You are here

function _patterns_import_check_name in Patterns 7

Same name and namespace in other branches
  1. 7.2 includes/forms/ \_patterns_import_check_name()

Helper function to be called in one of the import validation handlers.

2 calls to _patterns_import_check_name()
patterns_import_validate in includes/forms/
patterns_lab_validate in includes/forms/
Checks if the patterns directory is ready and if the file name for exported patterns is valid.


includes/forms/, line 25
Importing Patterns from a file or using an URL.


function _patterns_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;