[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
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\Component\Fields\Administrator\Helper\FieldsHelper; 14 15 // Check if we have all the data 16 if (!array_key_exists('item', $displayData) || !array_key_exists('context', $displayData)) { 17 return; 18 } 19 20 // Setting up for display 21 $item = $displayData['item']; 22 23 if (!$item) { 24 return; 25 } 26 27 $context = $displayData['context']; 28 29 if (!$context) { 30 return; 31 } 32 33 $parts = explode('.', $context); 34 $component = $parts[0]; 35 $fields = null; 36 37 if (array_key_exists('fields', $displayData)) { 38 $fields = $displayData['fields']; 39 } else { 40 $fields = $item->jcfields ?: FieldsHelper::getFields($context, $item, true); 41 } 42 43 if (!$fields) { 44 return; 45 } 46 47 // Check if we have mail context in first element 48 $isMail = (reset($fields)->context == 'com_contact.mail'); 49 50 if (!$isMail) { 51 // Print the container tag 52 echo '<dl class="fields-container contact-fields dl-horizontal">'; 53 } 54 55 // Loop through the fields and print them 56 foreach ($fields as $field) { 57 // If the value is empty do nothing 58 if (!strlen($field->value) && !$isMail) { 59 continue; 60 } 61 62 $layout = $field->params->get('layout', 'render'); 63 echo FieldsHelper::render($context, 'field.' . $layout, array('field' => $field)); 64 } 65 66 if (!$isMail) { 67 // Close the container 68 echo '</dl>'; 69 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |