Skip to content

Commit

Permalink
Fix clear radio not showing for non-admin user
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Jan 3, 2025
1 parent 34084de commit b38144c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 44 deletions.
31 changes: 4 additions & 27 deletions templates/CRM/Profile/Form/Dynamic.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
{/if}
{assign var="profileID" value=$field.group_id}
{assign var="profileFieldName" value=$field.name}
{assign var="rowIdentifier" value=$field.name}
{assign var="formElement" value=$form.$profileFieldName}

{if $field.groupTitle != $fieldset}
{if $mode neq 8 && $mode neq 4}
Expand Down Expand Up @@ -96,34 +98,9 @@
</div>
{/if}
{if array_key_exists('options_per_line', $field) && $field.options_per_line}
<div class="crm-section editrow_{$profileFieldName}-section form-item" id="editrow-{$profileFieldName}">
<div class="label">{$form.$profileFieldName.label}</div>
<div class="content edit-value">
{assign var="count" value=1}
{strip}
<table class="form-layout-compressed">
<tr>
{* sort by fails for option per line. Added a variable to iterate through the element array*}
{foreach name=outer key=key item=item from=$form.$profileFieldName}
{* There are both numeric and non-numeric keys mixed in here, where the non-numeric are metadata that aren't arrays with html members. *}
{if is_array($item) && array_key_exists('html', $item)}
<td class="labels font-light">{$form.$profileFieldName.$key.html}</td>
{if $count == $field.options_per_line}
</tr>
<tr>
{assign var="count" value=1}
{else}
{assign var="count" value=$count+1}
{/if}
{/if}
{/foreach}
</tr>
</table>
{/strip}
</div>
<div class="clear"></div>
{include file="CRM/UF/Form/FieldRadioOptionsPerLine.tpl"}
</div>{* end of main edit section div*}
{else}
{else}
<div id="editrow-{$profileFieldName}" class="crm-section editrow_{$profileFieldName}-section form-item">
<div class="label">
{$form.$profileFieldName.label}
Expand Down
20 changes: 20 additions & 0 deletions templates/CRM/UF/Form/FieldRadioOptionsPerLine.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<div class="crm-section editrow_{$profileFieldName}-section form-item" id="editrow-{$rowIdentifier}">
<div class="label option-label">{$formElement.label}</div>
<div class="content">
<div class="crm-multiple-checkbox-radio-options crm-options-per-line" style="--crm-opts-per-line:{$field.options_per_line};">
{foreach name=outer key=key item=item from=$formElement}
{if is_array($item) && array_key_exists('html', $item)}
<div class="crm-option-label-pair" >{$formElement.$key.html}</div>
{/if}
{/foreach}
</div>
{* Include the edit options list for admins *}
{if $formElement.html|strstr:"crm-option-edit-link"}
{$formElement.html|regex_replace:"@^.*(<a href=.*? class=.crm-option-edit-link.*?</a>)$@":"$1"}
{else}
{$formElement.html}
{/if}
</div>
<div class="clear"></div>
</div>
<div class="clear"></div>
18 changes: 1 addition & 17 deletions templates/CRM/UF/Form/Fields.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,7 @@
</div>
{/if}
{if array_key_exists('options_per_line', $field) && $field.options_per_line != 0}
<div class="crm-section editrow_{$profileFieldName}-section form-item" id="editrow-{$rowIdentifier}">
<div class="label option-label">{$formElement.label}</div>
<div class="content">
<div class="crm-multiple-checkbox-radio-options crm-options-per-line" style="--crm-opts-per-line:{$field.options_per_line};">
{foreach name=outer key=key item=item from=$formElement}
{if is_array($item) && array_key_exists('html', $item)}
<div class="crm-option-label-pair" >{$formElement.$key.html}</div>
{/if}
{/foreach}
</div>
{* Include the edit options list for admins *}
{if $formElement.html|strstr:"crm-option-edit-link"}
{$formElement.html|regex_replace:"@^.*(<a href=.*? class=.crm-option-edit-link.*?</a>)$@":"$1"}
{/if}
</div>
<div class="clear"></div>
</div>
{include file="CRM/UF/Form/FieldRadioOptionsPerLine.tpl"}
{else}
<div class="crm-section editrow_{$profileFieldName}-section form-item" id="editrow-{$rowIdentifier}">
<div class="label">
Expand Down

0 comments on commit b38144c

Please sign in to comment.