User tests: Successful: Unsuccessful:
Adds the output of only the fields value as a standard layout
In Custom Fields you can Override the render.php file.
However it might be a very common usecase to render only the value of a field so i added it in the folder.
Implement a field over the editor with for example {field 1, value}
Only the value of the field should be shown
Layout has to be created by the user
Status | New | ⇒ | Pending |
Category | ⇒ | Front End com_fields |
Title |
|
Title |
|
Not 100%... it´s regarding rendering only the value inside the WYSIWYG Editor without any stuff (code) around. Only the pure value.
thats what it should be doing.. what is it not doing correctly?
That's a bug then if you have set label not to show
Yes, and no...
It´s done like that, that the label is not shown but the Value is shown in a correct styling when using "Automatic Display".
My PR is to output only the pure value without any markup in the editor.
The contact component has an override for the JLayout and works slightly different than the regular field JLayout. I think there is a PR open which adds support for the hide label option there (not sure I remember right).
Edit: Found the PR (#15756) but looking at the output that is already in effect here.
In the regular JLayout for a single field, if you set the label to hide you only get the value with the <span>
around it, which imho is fine.
Labels |
Added:
?
|
Yep, as said it doesn't solve your issue here. But it's an issue with the JLayout used in com_contact. Ideally the markup for the definition list should be in the main layout and not in the field one.
It also gives you invalid HTML if you render that field alone in an editor field because it will not add the <dl>
tag (that's done by the parent layout).
It doesn't really need a new Jlayout in com_fields. For all other extensions setting the label to hide should work quite nice.
Ok i checked now with Article and you are right... And the Output class is not implemented in this "span"... should i report it as a bug?
And the second question is... i understand that the <dd>
is implemented in the foreach loop in the Contact Layout but why does the field render in the editor also with <dd>
... ?
And the Output class is not implemented in this "span"... should i report it as a bug?
Good question. It's implemented in the parent layout. Adding it to the field layout would give you the class once on the parent <dd>
and then again on the label and value spans. That could have strange effects if the CSS is not done specific to the <dd>
.
But ideally, it would be in the field layout, I agree.
i understand that the
<dd>
is implemented in the foreach loop in the Contact Layout but why does the field render in the editor also with<dd>
... ?
In the regular fields layout, the whole definiton list markup is in the fields layout. In the contact one only the <dl>
is in the fields, the <dt>
and <dd>
are in the field one. See https://github.com/joomla/joomla-cms/blob/staging/components/com_contact/layouts/field/render.php#L35-L42
i understand that the
is implemented in the foreach loop in the Contact Layout but why does the field render in the editor also with ... ? In the regular fields layout, the whole definiton list markup is in the fields layout. In the contact one only the
is in the fields, the
- and
- are in the field one. See https://github.com/joomla/joomla-cms/blob/staging/components/com_contact/layouts/field/render.php#L35-L42
It´s weird it took my override/layout from the general field layout then?
Yep. The override system works like this.
You specify the layout you want to use, eg your "value" one. And you use it in com_contact. Joomla then looks in the following folders for a layout (from memory):
... if that would be consistent it should take the /com_fields/layouts/field/render.php if render does not exist in contact...? Doesn´t work for me, maybe we can have a chat about this behaviour in com_contact
If you delete this file: https://github.com/joomla/joomla-cms/blob/staging/components/com_contact/layouts/field/render.php (and don't have an override for it in the template), then yes it should take the generic one from com_fields.
It has to look first on com_contact and then com_fields, like that you can do overrides only for com_contact or for all components trough com_fields.
So this PR can be closed, right?
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-07-26 07:48:01 |
Closed_By | ⇒ | coolcat-creations |
That is what the option to hide the label is for