[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/components/com_contact/tmpl/contact/ -> default_user_custom_fields.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Site
   5   * @subpackage  com_contact
   6   *
   7   * @copyright   (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9   */
  10  
  11  defined('_JEXEC') or die;
  12  
  13  use Joomla\CMS\Application\ApplicationHelper;
  14  use Joomla\CMS\Language\Text;
  15  
  16  $params             = $this->item->params;
  17  
  18  $displayGroups      = $params->get('show_user_custom_fields');
  19  $userFieldGroups    = array();
  20  ?>
  21  
  22  <?php if (!$displayGroups || !$this->contactUser) : ?>
  23      <?php return; ?>
  24  <?php endif; ?>
  25  
  26  <?php foreach ($this->contactUser->jcfields as $field) : ?>
  27      <?php if ($field->value && (in_array('-1', $displayGroups) || in_array($field->group_id, $displayGroups))) : ?>
  28          <?php $userFieldGroups[$field->group_title][] = $field; ?>
  29      <?php endif; ?>
  30  <?php endforeach; ?>
  31  
  32  <?php foreach ($userFieldGroups as $groupTitle => $fields) : ?>
  33      <?php $id = ApplicationHelper::stringURLSafe($groupTitle); ?>
  34      <?php echo '<h3>' . ($groupTitle ?: Text::_('COM_CONTACT_USER_FIELDS')) . '</h3>'; ?>
  35  
  36      <div class="com-contact__user-fields contact-profile" id="user-custom-fields-<?php echo $id; ?>">
  37          <dl class="dl-horizontal">
  38          <?php foreach ($fields as $field) : ?>
  39              <?php if (!$field->value) : ?>
  40                  <?php continue; ?>
  41              <?php endif; ?>
  42  
  43              <?php if ($field->params->get('showlabel')) : ?>
  44                  <?php echo '<dt>' . Text::_($field->label) . '</dt>'; ?>
  45              <?php endif; ?>
  46  
  47              <?php echo '<dd>' . $field->value . '</dd>'; ?>
  48          <?php endforeach; ?>
  49          </dl>
  50      </div>
  51  <?php endforeach; ?>


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer