You are here

function organigrams_check_machine_name in Organigrams 7

Add an index to a machine name if it already exists to make sure its unique.

Parameters

string $name: An organigrams machine name.

Return value

string A unique organigrams machine name.

1 call to organigrams_check_machine_name()
organigrams_form_import_submit in ./organigrams.admin.inc
Submit function for organigrams_form_import.

File

./organigrams.module, line 1462
Defines the organigrams functions and entity types.

Code

function organigrams_check_machine_name($name) {
  $index = 0;
  $new_name = $name;
  while (organigrams_machine_name_load($new_name)) {
    $new_name = $name . '_' . $index++;
  }
  return $new_name;
}