?
avatar ced1870
ced1870
9 Jun 2017

Steps to reproduce the issue

1/ create a custom field for an article
2/ create a custom field for a contact

Expected result

both fields have the same html output

Actual result

both fields are rendered differently.

1/ In the article

<dd class="field-entry">
<span class="field-label">test: </span>
<span class="field-value">here is my test</span>
</dd>

2/ in the contact

<dt class="contact-field-entry">
<span class="field-label">test: </span>
</dt>
<dd class="contact-field-entry">
<span class="field-value">here is my test</span>
</dd>

System information (as much as possible)

Joomla 3.7

Additional comments

In my opinion, we shall keep the same structure for all custom fields and not have so much difference. Here not only that the css classes are different, also the HTMl is different

We should use something like this which is more general and flexible

For article

<dd class="field-entry contact-field-content">
<span class="field-label">test: </span>
<span class="field-value">here is my test</span>
</dd>

For contact

<dd class="field-entry contact-field-contact">
<span class="field-label">test: </span>
<span class="field-value">here is my test</span>
</dd>

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
3.00

avatar ced1870 ced1870 - open - 9 Jun 2017
avatar joomla-cms-bot joomla-cms-bot - labeled - 9 Jun 2017
avatar ced1870 ced1870 - change - 9 Jun 2017
The description was changed
avatar ced1870 ced1870 - edited - 9 Jun 2017
avatar Bakual
Bakual - comment - 9 Jun 2017

Contact has an override for the field JLayout. So this is expected to be different due to different JLayouts being used.

Of course trying to make them consistent would be great.

avatar ced1870
ced1870 - comment - 9 Jun 2017

thanks for your answer. In my mind by default we shall have a structure that is common to all components. Then the developpers/integrators can use the overrides to do what they want of course.

Now for example if I want to style the fields in my website, I have to use multiple css rules depending on how joomla renders them in each page. This is not correct I think
Having by default an override has no sense for me

Really, making things simpler would be great :)


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/16594.

avatar ced1870
ced1870 - comment - 9 Jun 2017

My code suggestion in the contact JLayout override

in
components/com_contact/layouts/field

<?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;

if (!key_exists('field', $displayData))
{
return;
}

$field = $displayData['field'];
$label = $field->label;
$value = $field->value;
$class = $field->params->get('render_class');
$showlabel = $field->params->get('showlabel');

if (!$value)
{
return;
}

if ($field->context == 'com_contact.mail')
{
// Prepare the value for the contact form mail
echo $label . ': ' . $value . "\r\n";
return;
}

?>

<dd class="field-entry contact-field-entry <?php echo $class; ?>">
<?php if ($showlabel == 1) : ?>
<span class="field-label"><?php echo htmlentities($label, ENT_QUOTES | ENT_IGNORE, 'UTF-8'); ?>: </span>
<?php endif; ?>
<span class="field-value"><?php echo $value; ?></span>
</dd>


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/16594.
avatar Bakual
Bakual - comment - 9 Jun 2017

Since you already propose some code, can you try making a Pull Request?
Some documentation can be found here: https://docs.joomla.org/Using_the_Github_UI_to_Make_Pull_Requests

avatar franz-wohlkoenig franz-wohlkoenig - change - 9 Jun 2017
Status New Discussion
avatar brianteeman
brianteeman - comment - 20 Aug 2017

Closed as I made a PR for the above change.

avatar brianteeman brianteeman - change - 20 Aug 2017
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2017-08-20 11:10:13
Closed_By brianteeman
avatar brianteeman brianteeman - close - 20 Aug 2017

Add a Comment

Login with GitHub to post a comment