Skip to content

Commit

Permalink
Further the conversion to deal with non-entity pseudofield
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Nov 15, 2018
1 parent 7f3c8b3 commit cbd71f7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
28 changes: 17 additions & 11 deletions CRM/UF/Form/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ protected function setEntityFields() {
'title' => ['name' => 'title'],
'frontend_title' => ['name' => 'frontend_title'],
'description' => ['name' => 'description', 'help' => ['id' => 'id-description', 'file' => 'CRM/UF/Form/Group.hlp']],
'uf_group_type' => ['name' => 'uf_group_type', 'not-auto-addable' => TRUE, 'help' => ['id' => 'id-used_for', 'file' => 'CRM/UF/Form/Group.hlp'], 'post_html_text' => ' ' . $this->getOtherModuleString()]
];
}

Expand Down Expand Up @@ -266,17 +267,6 @@ public function setDefaultValues() {
}
$defaults['uf_group_type'] = isset($checked) ? $checked : "";

//get the uf join records for current uf group other than default modules
$otherModules = array();
$otherModules = CRM_Core_BAO_UFGroup::getUFJoinRecord($this->_id, TRUE, TRUE);
if (!empty($otherModules)) {
$otherModuleString = NULL;
foreach ($otherModules as $key) {
$otherModuleString .= " [ x ] <label>" . $key . "</label>";
}
$this->assign('otherModuleString', $otherModuleString);
}

$showAdvanced = 0;
$advFields = array(
'group',
Expand Down Expand Up @@ -422,4 +412,20 @@ public function postProcess() {
*/
public function setDeleteMessage() {}

/**
* Get the string to display next to the used for field indicating unchangeable uses.
*
* @return string
*/
protected function getOtherModuleString() {
$otherModules = CRM_Core_BAO_UFGroup::getUFJoinRecord($this->_id, TRUE, TRUE);
if (!empty($otherModules)) {
$otherModuleString = NULL;
foreach ($otherModules as $key) {
$otherModuleString .= " [ x ] <label>" . $key . "</label>";
}
}
return $otherModuleString;
}

}
2 changes: 1 addition & 1 deletion templates/CRM/Core/Form/Field.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
{/capture}{help id=$help.id file=$help.file}{/if}
{if $action == 2 && $fieldSpec.is_add_translate_dialog}{include file='CRM/Core/I18n/Dialog.tpl' table=$entityTable field=$fieldName id=$entityID}{/if}
</td>
<td>{if $form.$fieldName.html}{if $fieldSpec.formatter === 'crmMoney'}{$form.$fieldName.html|crmMoney}{else}{$form.$fieldName.html}{/if}{else}{$fieldSpec.place_holder}{/if}<br />
<td>{$fieldSpec.pre_html_text}{if $form.$fieldName.html}{if $fieldSpec.formatter === 'crmMoney'}{$form.$fieldName.html|crmMoney}{else}{$form.$fieldName.html}{/if}{else}{$fieldSpec.place_holder}{/if}{$fieldSpec.post_html_text}<br />
{if $fieldSpec.description}<span class="description">{$fieldSpec.description}</span>{/if}
{if $fieldSpec.documentation_link}{docURL page=$fieldSpec.documentation_link.page resource=$fieldSpec.documentation_link.resource}{/if}
</td>
Expand Down
4 changes: 0 additions & 4 deletions templates/CRM/UF/Form/Group.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@
{include file="CRM/Core/Form/Field.tpl"}
</tr>
{/foreach}
<tr class="crm-uf_group-form-block-uf_group_type">
<td class="label">{$form.uf_group_type.label} {help id='id-used_for' file="CRM/UF/Form/Group.hlp"}</td>
<td class="html-adjust">{$form.uf_group_type.html}&nbsp;{$otherModuleString}</td>
</tr>
<tr class="crm-uf_group-form-block-weight" >
<td class="label">{$form.weight.label}{if $config->userSystem->is_drupal EQ '1'} {help id='id-profile_weight' file="CRM/UF/Form/Group.hlp"}{/if}</td>
<td class="html-adjust">{$form.weight.html}</td>
Expand Down
3 changes: 3 additions & 0 deletions xml/schema/Core/UFGroup.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@
<type>int</type>
<required>true</required>
<default>1</default>
<html>
<type>Text</type>
</html>
<comment>Controls display order when multiple user framework groups are setup for concurrent display.</comment>
<add>1.2</add>
<drop>1.3</drop>
Expand Down

0 comments on commit cbd71f7

Please sign in to comment.