Skip to content

Commit

Permalink
Migrate user groups from categories to field groups
Browse files Browse the repository at this point in the history
  • Loading branch information
laoneo committed Dec 6, 2016
1 parent cb24efe commit 2670895
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
5 changes: 3 additions & 2 deletions administrator/components/com_contact/config.xml
Expand Up @@ -5,6 +5,7 @@
name="contact"
label="COM_CONTACT_FIELD_CONFIG_INDIVIDUAL_CONTACT_DISPLAY"
description="COM_CONTACT_FIELD_CONFIG_INDIVIDUAL_CONTACT_DESC"
addfieldpath="/administrator/components/com_fields/models/fields"
>

<field
Expand Down Expand Up @@ -339,9 +340,9 @@

<field
name="show_user_custom_fields"
type="category"
type="fieldgroups"
multiple="true"
extension="com_users.user.fields"
extension="com_users"
label="COM_CONTACT_FIELD_USER_CUSTOM_FIELDS_SHOW_LABEL"
description="COM_CONTACT_FIELD_USER_CUSTOM_FIELDS_SHOW_DESC"
>
Expand Down
5 changes: 3 additions & 2 deletions components/com_contact/views/contact/tmpl/default.xml
Expand Up @@ -33,6 +33,7 @@
<!-- Basic options. -->
<fieldset name="params"
label="COM_CONTACT_BASIC_OPTIONS_FIELDSET_LABEL"
addfieldpath="/administrator/components/com_fields/models/fields"
>
<field name="presentation_style"
type="list"
Expand Down Expand Up @@ -273,9 +274,9 @@

<field
name="show_user_custom_fields"
type="category"
type="fieldgroups"
multiple="true"
extension="com_users.user.fields"
extension="com_users"
label="COM_CONTACT_FIELD_USER_CUSTOM_FIELDS_SHOW_LABEL"
description="COM_CONTACT_FIELD_USER_CUSTOM_FIELDS_SHOW_DESC"
>
Expand Down
Expand Up @@ -20,14 +20,14 @@
<?php return; ?>
<?php endif; ?>

<?php foreach ($this->contactUser->fields as $field) :?>
<?php if (!in_array('-1', $displayGroups) && !in_array($field->catid, $displayGroups)) : ?>
<?php foreach ($this->contactUser->fields as $field) : ?>
<?php if (!in_array('-1', $displayGroups) && $field->group_id && !in_array($field->group_id, $displayGroups)) : ?>
<?php continue; ?>
<?php endif; ?>
<?php if (!key_exists($field->category_title, $userFieldGroups)) : ?>
<?php $userFieldGroups[$field->category_title] = array();?>
<?php if (!key_exists($field->group_title, $userFieldGroups)) : ?>
<?php $userFieldGroups[$field->group_title] = array();?>
<?php endif; ?>
<?php $userFieldGroups[$field->category_title][] = $field;?>
<?php $userFieldGroups[$field->group_title][] = $field;?>
<?php endforeach; ?>

<?php foreach ($userFieldGroups as $categoryTitle => $fields) :?>
Expand Down
Expand Up @@ -20,13 +20,13 @@
<?php endif; ?>

<?php foreach ($this->contactUser->fields as $field) :?>
<?php if (!in_array('-1', $displayGroups) && !in_array($field->catid, $displayGroups)) : ?>
<?php if (!in_array('-1', $displayGroups) && $field->group_id && !in_array($field->group_id, $displayGroups)) : ?>
<?php continue; ?>
<?php endif; ?>
<?php if (!key_exists($field->category_title, $userFieldGroups)) : ?>
<?php $userFieldGroups[$field->category_title] = array();?>
<?php if (!key_exists($field->group_title, $userFieldGroups)) : ?>
<?php $userFieldGroups[$field->group_title] = array();?>
<?php endif; ?>
<?php $userFieldGroups[$field->category_title][] = $field;?>
<?php $userFieldGroups[$field->group_title][] = $field;?>
<?php endforeach; ?>

<?php foreach ($userFieldGroups as $categoryTitle => $fields) :?>
Expand Down

0 comments on commit 2670895

Please sign in to comment.