Commit 719ac93d authored by totten's avatar totten
Browse files

Merge branch 'prefix' into 'master'

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

Closes #10

See merge request extensions/afform!22
parents 4a6fcfe1 abbec4ea
......@@ -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