Commit abbec4ea authored by colemanw's avatar colemanw
Browse files

Fix #10 add prefix to new afforms to prevent name conflicts

parent 047d6c6c
......@@ -16,7 +16,8 @@ trait AfformSaveTrait {
// If no name given, create a unique name based on the title
if (empty($item['name'])) {
$item['name'] = _afform_angular_module_name(\CRM_Utils_String::munge($item['title'], '-'));
$prefix = !empty($item['join']) ? "afjoin-{$item['join']}" : !empty($item['block']) ? 'afblock-' . str_replace('*', 'all', $item['block']) : 'afform';
$item['name'] = _afform_angular_module_name($prefix . '-' . \CRM_Utils_String::munge($item['title'], '-'));
$suffix = '';
while (
file_exists($scanner->createSiteLocalPath($item['name'] . $suffix, \CRM_Afform_AfformScanner::METADATA_FILE))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment