From 4096e4b0b79e6a90c7e3d0eef1d3dc35f117b82a Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Wed, 5 May 2021 09:20:18 -0400 Subject: [PATCH] Afform - Set default position for contact layout editor This makes afform blocks appear in their default positions on the system default layout in contactlayout 2.0+ It's backward-compatible with earlier versions of the extension --- ext/afform/core/afform.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ext/afform/core/afform.php b/ext/afform/core/afform.php index 08a29e2a91..5529e0bdbe 100644 --- a/ext/afform/core/afform.php +++ b/ext/afform/core/afform.php @@ -245,7 +245,7 @@ function afform_civicrm_contactSummaryBlocks(&$blocks) { ->setSelect(['name', 'title', 'directive_name', 'module_name', 'type', 'type:icon', 'type:label']) ->addWhere('contact_summary', '=', 'block') ->execute(); - foreach ($afforms as $afform) { + foreach ($afforms as $index => $afform) { // Create a group per afform type $blocks += [ "afform_{$afform['type']}" => [ @@ -263,6 +263,7 @@ function afform_civicrm_contactSummaryBlocks(&$blocks) { $afform['type:label'], ], 'edit' => 'civicrm/admin/afform#/edit/' . $afform['name'], + 'system_default' => [0, $index % 2], ]; } } -- 2.25.1