?
avatar Sukinoz
Sukinoz
19 Mar 2017

Steps to reproduce the issue

Create new article, withe some text:
In the Content Tab, press de Button "Fields".
Select a custom field and insert it
Yo see this html code:
<p>This is an article text with the {field 1} inserted within this paragraph.</p>

Expected result

You expect to see this html code in the frontend:
<p>This is an article text with the <span class="field-value">field 1 value</span> inserted within this sentence.</p>

Actual result

The actual result is a the inclusion of the description list tag

with the Field Value, so the original paragraph breaks in 3 lines.

	<p>This is an article text with the 
<dd class="field-entry " id="field-entry-1">
		<span class="field-value">field 1 value</span>
</dd>
 inserted in an article.</p> 	</div>

System information (as much as possible)

joomla 3.7

Additional comments

avatar Sukinoz Sukinoz - open - 19 Mar 2017
avatar joomla-cms-bot joomla-cms-bot - change - 19 Mar 2017
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 19 Mar 2017
avatar coolcat-creations
coolcat-creations - comment - 19 Mar 2017

From my view it´s actually not really a bug but something that needs indeed huge improvement. The problem is, that you can´t know how the User wants to implement the specific fields so you can´t define a specific rendering. What if it´s not a paragraph but a container? What if the Field is not a value but a slideshow or something?

Maybe it´s a solution to offer a raw output of the field Value or text without any Label or Markup.
I see that your test, which was very important, shows that this needs some more thoughts.

It needs to be defined how all of the Joomla! Core custom fields would be rendered in Article, Category, Contactinformation and Contactcategory view when automatic display is off.

avatar Sukinoz
Sukinoz - comment - 22 Mar 2017

Maybe better alow to insert the "field title" and "field value" separated.
And insert them inside the article just the field value without tags, because the users know how we wants to implement it, so we will insert them inside a parragraf or a div o watever we need.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/14753.
avatar Bakual
Bakual - comment - 23 Mar 2017

The plugin uses the JLayout that is used always when a field is rendered. Just override that one and you can adjust it to your needs.
For a single field, it's this layout: https://github.com/joomla/joomla-cms/blob/staging/components/com_fields/layouts/field/render.php

It can be overriden also on component level, eg if you want the fields to render differently in an article, you can do that.

avatar Sukinoz
Sukinoz - comment - 23 Mar 2017

Thanks for replaying

But seems that this layout renders the inclusion Inside de Article (great: you can remove tags from the render.php, and after insert them manualy inside the article text editor if you want), buuuut seems that also this layout renders the "Automatic Display" option (ups, here you need the predefined tags!).

avatar Bakual
Bakual - comment - 23 Mar 2017

Yep as said, it always uses the same layout, doesn't matter where it is rendered. From a code view there is no difference if it's in the "automatic display" or within an article.

Maybe we need to remove the

from the layout and put add it somewhere else for the automatic display.

avatar Sukinoz
Sukinoz - comment - 28 Mar 2017

Hello @Bakual ,

Thanks for replaying, but what do you mean with this sentence?:

Maybe we need to remove the

from the layout and put add it somewhere else for the automatic display.

avatar Bakual
Bakual - comment - 28 Mar 2017

Edited my comment above so the tag shows ?

avatar laoneo
laoneo - comment - 30 Mar 2017

A solution can be to use a second layout for the inline fields or to switch to a template engine (eg. Mustache) like DPFields has and was included in the early stages of com_fields, more information why and why not can be found here joomla-projects/custom-fields#135.

avatar Bakual
Bakual - comment - 30 Mar 2017

I don't think it needs a second layout. The current one just has to much in it and that <dd> tag should go to the calling layout instead.

avatar Sukinoz
Sukinoz - comment - 30 Mar 2017

Thanks @laoneo and @Bakual for replaying,

From my point of view, the objective of including selected fields inside the article content should be different from the "automatic display", so we need a different way to do it.

Case 1: "AUTOMATIC Display":

  • To display the COMPLETE LIST OF FIELDS (so, with <dd> or <div> it is ok).
  • To display them rendered automatically (with render.php)
  • To display them automatically "After Tittle", "After the article", etc. (as defined in field options).
  • Showing the label or not automatically (as defined in field options).

...this is how joomla 3.7 is working now. Great. everything automatic, as expected!

Case 2: "MANUALLY display":
this is the {field x} way, but now J3.7 it is not working as expected (of course, from my point of view)

  • To display ONLY THE SELECTED FIELD manually (only show the fields we manually choose)
  • To display it where we want inside the article content (inserting manually the {field X} )
  • To render it manual (Adding manually the tags we want: <b>{field X}</b>)
  • To select manually if we want to insert the field label or the field value. ({field 1:label} and {field 1:value})

For example:

  • Field 1 label: Year In

  • Field 1 data: 2013

  • Field 2 label: Year Out

  • Field 2 data: 2015

Automatic display:
I expect every fields automatic rendered like this:

<dd class="" id="field-entry-2">
		<span class="field-label">year in: </span>
		<span class="field-value">2013</span>
</dd>
<dd class="" id="field-entry-2">
		<span class="field-label">year out: </span>
		<span class="field-value">2013</span>
</dd>

Manual Display:
I expect i can do something like this:

<p>This article content is about something which 
<b>{field 1:label}</b> was on the <i>{field 1:value}</i>, 
and its <b>{field 2:label}</b> was on the <i>{field 2:value}</i>.</p>

<p>Remember: <span style="font-size: 14pt;">{field 2:value}</span> 
and <span style="font-size: 14pt;">{field 2:value}</span></p>

Of course, it is just my point of view. Thanks for reading.

avatar joomla-cms-bot joomla-cms-bot - edited - 30 Mar 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 30 Mar 2017
Category com_fields
avatar Bakual
Bakual - comment - 30 Mar 2017

See #15013 for fixing the <dd> in the article body.

To select manually if we want to insert the field label or the field value. ({field 1:label} and {field 1:value})

We can improve on that later if someone wants to write the code for it. This should be possible in a B/C manner.
On the other hand you can already set the field label to hide and it will also not show in the article body (so it is possibly to only show the value). If you only want to show the label, you could as well just write it manually.

avatar Sukinoz
Sukinoz - comment - 30 Mar 2017

@bakual thank for replaying,

But reading what you said:

See #15013 for fixing the <dd> in the article body.

And

On the other hand you can already set the field label to hide and it will also not show in the article body (so it is possibly to only show the value)

I see i didnt explain well, because this is not the problen and either the solution.

Maybe my English is not good enough. I am trying to explain again:

Yes i know you can set the field label to hide . I have wrote about it in "Case 1: Automatic Display".
It is great to show a "<dd>field label: field value</dd>" list of fields automatically.
<dd> or whatever else (div, table, li...).
This part is working great.

But the problem i am trying to explain here is another:
If after that "automatic display", you want to also insert some fields manually inside the article content (Case 2 Insert manually):

  1. you can not insert only the value.
  2. you can not insert it inside the text of the content. Something like this is imposible:
    <p>This is an article with this <b> {field 1 value} </b> inside the content.<p>

Hope i have explained better now.

avatar Bakual
Bakual - comment - 30 Mar 2017

Yep, that is true. If you want to have the field both in automatic display shown with the label and in the article without, that is not possible today.
But as said, this should be possible to do later as it has no B/C implications. I will likely not have the time to do it but if anyone else wants to do it should be possible.

avatar Sukinoz
Sukinoz - comment - 30 Mar 2017

I understand.

You dont have time and i dont have enough knowledge to do it. Hope someone have both...

Thanks for your time!

avatar Bakual
Bakual - comment - 31 Mar 2017

@Sukinoz @laoneo I was a bit bored today at work and got an idea: #15027
This will allow for alternative layouts to be used by the plugin tag. That would allow to customise the appearance of the field within an article body. So you could create a layout which only shows the label or only the value or whatever.

avatar laoneo
laoneo - comment - 1 Apr 2017

Can we close this issue as we have a pr?

avatar brianteeman brianteeman - change - 1 Apr 2017
Status New Closed
Closed_Date 0000-00-00 00:00:00 2017-04-01 12:53:03
Closed_By brianteeman
avatar brianteeman brianteeman - close - 1 Apr 2017
avatar brianteeman
brianteeman - comment - 1 Apr 2017

closed as we have a Pr #15027

Add a Comment

Login with GitHub to post a comment