* @param string $name
*/
public function buildCustom($id, $name) {
+ if ($name === 'customPost') {
+ $this->assign('postPageProfiles', []);
+ }
+ $this->assign($name, []);
if (!$id) {
- $this->assign($name, []);
return;
}
) {
CRM_Core_BAO_Address::checkContactSharedAddressFields($fields, $contactID);
}
+ if ($name === 'customPost') {
+ $postPageProfiles = [];
+ foreach ($fields as $fieldName => $field) {
+ $postPageProfiles[$field['groupName']][$fieldName] = $field;
+ }
+ $this->assign('postPageProfiles', $postPageProfiles);
+ }
+ // We still assign the customPost in the way we used to because we haven't ruled out being
+ // used after the register form - but in the register form it is overwritten by a for-each
+ // with the smarty code.
$this->assign($name, $fields);
if (is_array($fields)) {
$button = substr($this->controller->getButtonName(), -4);
{/if}
<div class="crm-public-form-item crm-section custom_post-section">
- {include file="CRM/UF/Form/Block.tpl" fields=$customPost prefix=false hideFieldset=false}
+ {foreach from=$postPageProfiles item=customPost}
+ {include file="CRM/UF/Form/Block.tpl" fields=$customPost prefix=false hideFieldset=false}
+ {/foreach}
</div>
<div id="crm-submit-buttons" class="crm-submit-buttons">