CoreFiles by mySites.guru
render.php77 lines, 1,459 bytes, from Joomla_3.7.0-beta1-Beta-Full_Package.zip
Raw History Compare with 3.6.0-beta2
md5
a2ae4f7fa06524f55e541515518ed22c
sha1
1e7347d3b0b253519f1fda52a2f421215a319e28
sha256
53da1fc274c6a82ba7362cac6b1443f2cb76c9d3676c317b0695363a5b5816ba
<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_contact
 *
 * @copyright   Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die;

// Check if we have all the data
if (!key_exists('item', $displayData) || !key_exists('context', $displayData))
{
	return;
}

// Setting up for display
$item = $displayData['item'];

if (!$item)
{
	return;
}

$context = $displayData['context'];

if (!$context)
{
	return;
}

JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php');

$parts     = explode('.', $context);
$component = $parts[0];
$fields    = null;

if (key_exists('fields', $displayData))
{
	$fields = $displayData['fields'];
}
else
{
	$fields = $item->fields ?: FieldsHelper::getFields($context, $item, true);
}

if (!$fields)
{
	return;
}

// Check if we have mail context in first element
$isMail = (reset($fields)->context == 'com_contact.mail');

if (!$isMail)
{
	// Print the container tag
	echo '<dl class="fields-container contact-fields dl-horizontal">';
}

// Loop through the fields and print them
foreach ($fields as $field)
{
	// If the value is empty dp nothing
	if (!isset($field->value) || !$field->value)
	{
		continue;
	}

	echo FieldsHelper::render($context, 'field.render', array('field' => $field));
}

if (!$isMail)
{
	// Close the container
	echo '</dl>';
}

The same content is in 3 releases, Joomla 3.7.0-beta1 to 3.7.0-beta3. See them all, or every version of this file.