function taxonomy_csv_vocabulary_machine_name_create in Taxonomy CSV import/export 7.4
Same name and namespace in other branches
- 7.5 taxonomy_csv.vocabulary.api.inc \taxonomy_csv_vocabulary_machine_name_create()
Creates a machine name from a string.
The name is created by replacing non alphanumeric character by an underscore. Machine name is defined as first 16 cleaned characters of name and a random five characters serial. Fields module prepends 'taxonomy_' to name and check if total lenght is 21 characters max.
Parameters
$name: The string to process.
Return value
The processed string.
3 calls to taxonomy_csv_vocabulary_machine_name_create()
- taxonomy_csv_vocabulary_create in ./
taxonomy_csv.vocabulary.api.inc - Creates vocabulary by its name and returns vocabulary object.
- taxonomy_csv_vocabulary_duplicate in ./
taxonomy_csv.vocabulary.api.inc - Duplicates a vocabulary object. If not exist, creates an empty vocabulary.
- _taxonomy_csv_vocabulary_name_create in ./
taxonomy_csv.vocabulary.api.inc - Helper to create an unused vocabulary name from a string.
File
- ./
taxonomy_csv.vocabulary.api.inc, line 223 - Prepare and manage vocabularies.
Code
function taxonomy_csv_vocabulary_machine_name_create($name) {
return drupal_substr(preg_replace('/_+/i', '_', preg_replace('/[^a-z0-9\\_]/i', '_', drupal_strtolower(trim(strval($name))))), 0, 16) . strval(rand(10000, 99999));
}