? Success

User tests: Successful: Unsuccessful:

avatar coolcat-creations
coolcat-creations
16 May 2017

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.

Testing Instructions

Implement a field over the editor with for example {field 1, value}

Expected result

Only the value of the field should be shown

Actual result

Layout has to be created by the user

avatar coolcat-creations coolcat-creations - open - 16 May 2017
avatar coolcat-creations coolcat-creations - change - 16 May 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 16 May 2017
Category Front End com_fields
avatar coolcat-creations coolcat-creations - change - 16 May 2017
Title
Create value.php
[com_fields] Layout for output - value.php
avatar coolcat-creations coolcat-creations - change - 16 May 2017
Title
Create value.php
[com_fields] Layout for output - value.php
avatar coolcat-creations coolcat-creations - edited - 16 May 2017
avatar brianteeman
brianteeman - comment - 16 May 2017

That is what the option to hide the label is for
screenshotr10-01-25

avatar coolcat-creations
coolcat-creations - comment - 16 May 2017

Not 100%... it´s regarding rendering only the value inside the WYSIWYG Editor without any stuff (code) around. Only the pure value.

avatar brianteeman
brianteeman - comment - 16 May 2017

thats what it should be doing.. what is it not doing correctly?

avatar coolcat-creations
coolcat-creations - comment - 16 May 2017

If I want to write in the editor
it's day: {field 1}

and expect a result:

it's day: 16.05.2017

instead of such a code:
it's day:

16.05.2017

image

i can write with this pr it's day: {field 1, value}

avatar brianteeman
brianteeman - comment - 16 May 2017

That's a bug then if you have set label not to show

avatar coolcat-creations
coolcat-creations - comment - 16 May 2017

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.

avatar Bakual
Bakual - comment - 16 May 2017

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.

avatar coolcat-creations coolcat-creations - change - 18 May 2017
Labels Added: ?
avatar coolcat-creations
coolcat-creations - comment - 18 May 2017

If it was merged, then i still have all the code around the span...
image

avatar Bakual
Bakual - comment - 18 May 2017

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.

avatar coolcat-creations
coolcat-creations - comment - 18 May 2017

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?

avatar coolcat-creations
coolcat-creations - comment - 18 May 2017

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

avatar Bakual
Bakual - comment - 18 May 2017

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

avatar coolcat-creations
coolcat-creations - comment - 18 May 2017

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?

avatar Bakual
Bakual - comment - 18 May 2017

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):

  • /templates/your_template/html/layouts/com_contact/field/value.php
  • /components/com_contact/layouts/field/value.php
  • /templates/your_template/html/layouts/com_fields/field/value.php
  • /components/com_fields/layouts/field/value.php
avatar coolcat-creations
coolcat-creations - comment - 18 May 2017

... 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

avatar Bakual
Bakual - comment - 18 May 2017

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.

avatar laoneo
laoneo - comment - 18 May 2017

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.

avatar coolcat-creations
coolcat-creations - comment - 4 Jun 2017

So this PR can be closed, right?

avatar coolcat-creations coolcat-creations - change - 26 Jul 2017
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2017-07-26 07:48:01
Closed_By coolcat-creations
avatar coolcat-creations coolcat-creations - close - 26 Jul 2017

Add a Comment

Login with GitHub to post a comment