Skip to content

Commit

Permalink
Fix civicrm#10 add prefix to new afforms to prevent name conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
colemanw authored and CiviCRM committed Sep 16, 2020
1 parent 8cc0fa9 commit 43d8dd7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ext/afform/core/Civi/Api4/Utils/AfformSaveTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ protected function writeRecord($item) {

// 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))
Expand Down

0 comments on commit 43d8dd7

Please sign in to comment.