Skip to content

Comments

[4.0] Add display field attibute#32488

Merged
rdeutz merged 12 commits intojoomla:4.0-devfrom
ciar4n:display-attrib
Mar 10, 2021
Merged

[4.0] Add display field attibute#32488
rdeutz merged 12 commits intojoomla:4.0-devfrom
ciar4n:display-attrib

Conversation

@ciar4n
Copy link
Contributor

@ciar4n ciar4n commented Feb 21, 2021

Pull Request for Issue #32487 .

Summary of Changes

Because the 'class' XML attribute adds the class to the field itself rather than the outside container, it is not suitable for the classes added to #32422. This PR adds a parentclass attribute which adds a class to the outside control-group div.

Testing Instructions

Ensure #32422 works as described (updated to match)

Documentation Changes Required

@joomla-cms-bot joomla-cms-bot added NPM Resource Changed This Pull Request can't be tested by Patchtester PR-4.0-dev labels Feb 21, 2021
@drmenzelit
Copy link
Contributor

I have tested this item ✅ successfully on 7cef8cf

Tested in templateDetails.xml from Cassiopeia.


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

@chmst
Copy link
Contributor

chmst commented Mar 5, 2021

I have tested in com_content, article.xml and there it works fine.

grafik

But in Options (config.xml) there is no effect.

grafik

@joomla-cms-bot joomla-cms-bot removed the NPM Resource Changed This Pull Request can't be tested by Patchtester label Mar 6, 2021
@ciar4n
Copy link
Contributor Author

ciar4n commented Mar 6, 2021

@chmst Thank you for testing.

Strangely I am unable to replicate this issue. Adding to ..\administrator\components\com_config\forms\application.xml for example parentclass="span-2" works without issue.

image

@ciar4n
Copy link
Contributor Author

ciar4n commented Mar 6, 2021

@chmst My apologies. I see the issue now in component tabs as you said. I'll submit a fix.

@ciar4n
Copy link
Contributor Author

ciar4n commented Mar 6, 2021

@chmst Should be good now. 👍

@chmst
Copy link
Contributor

chmst commented Mar 6, 2021

I have tested this item ✅ successfully on 780fdc4

Tested wit com_content: article edit, com_content config.xml, com_users: user edit
and an own J4 component;
Documentation will be required. It is a great improvement. Thank you.


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

@drmenzelit
Copy link
Contributor

I have tested this item ✅ successfully on 780fdc4


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

@Quy Quy changed the title [4.0] Add display field attibute [4.0] Add display field attibute Mar 7, 2021
@Quy
Copy link
Contributor

Quy commented Mar 7, 2021

RTC


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Mar 7, 2021
@korenevskiy
Copy link
Contributor

korenevskiy commented Mar 7, 2021

  1. Using the display attribute is confusing, because after the display you want to write block. Yes, in general, and parentclass is also not clear about which parent we are talking about. I suggest using the controlclass attribute, we know that in the full sense of the control is just <div class= "control-group"/>
  2. I suggest making the layout multi-column. But with the observance of several rules. the note field and the spacer field will be full-width.
    Controls located between the note and spacer fields, only between them will be distributed in 2-3 columns. This will allow you not to create a garbage can from the fields. And of course the ability to use the controlclass attribute.
    But having the ability to override the default classes and set your own width in the number of columns.
    .
    In any case, now in Joomla Nightly 1 column mode, by analogy J3, looks better. 1 column is clearer and the most important thing is available. I propose to center 1 column in the middle.
    .
    How do I output a control-table without a Label?
    img-2021-03-07-23-58-39

@brianteeman
Copy link
Contributor

hiddenLabel="true"

@infograf768
Copy link
Member

@ciar4n

just a note: the code proposed is

if ($parentclass)
{
	$class .= ' ' . $parentclass;
}

As it already adds a space, we do not need the space in your example in #32422

<field
	name="article_layout"
	type="componentlayout"
	label="JFIELD_ALT_LAYOUT_LABEL"
	class="form-select"
	useglobal="true"
	extension="com_content"
	view="article"
        parentclass=" span-4 stack"
/>

also, I do not understand why, in this PR you add stack to the article layout in administrator/components/com_content/forms/article.xml as it does not have any effect.

https://github.com/joomla/joomla-cms/pull/32488/files#diff-48dcb2f2108f7b07952c9c407fd23cab28677e3d2fd437030b2f04a043282320R280-R286

@ciar4n
Copy link
Contributor Author

ciar4n commented Mar 8, 2021

@infograf768 My bad, I didn't mean to commit https://github.com/joomla/joomla-cms/pull/32488/files#diff-48dcb2f2108f7b07952c9c407fd23cab28677e3d2fd437030b2f04a043282320R280-R286 (reverted with cb121a5). The PR can remain in RTC as this class was ineffective.

And yes, no space is required in the example on #32422. I have edited this accordingly. Thanks for mentioning it!

@Quy Quy added this to the Joomla 4.0 milestone Mar 8, 2021
@ciar4n
Copy link
Contributor Author

ciar4n commented Mar 9, 2021

@korenevskiy I guess the logic of parentclass is that this class is been added to the parent div of the field that the rule is creating. Unlike the class attribute, this does not add it to the control class div.

@korenevskiy
Copy link
Contributor

korenevskiy commented Mar 9, 2021

@korenevskiy I guess the logic of parentclass is that this class is been added to the parent div of the field that the rule is creating. Unlike the class attribute, this does not add it to the control class div.

The control is < div class= "control-group" >. But the field is < input >. The field is located inside the control. The field has a parent that is a control. But the control also has a parent. It is intuitive for a layout designer who is unfamiliar with Joomla, but knows Bootstrap. ask which parent is being referred to when the class is specified, the parents of the control, or the parents of the field? But by specifying controlclass, it is clear that this is the class of the tag < div class="control group" > .

let the class be added directly to <div class= "control-group">
this will allow you to position the label at the same time.
Or can use another fieldclass class

@korenevskiy
Copy link
Contributor

korenevskiy commented Mar 9, 2021

by the way, after all these tricks, the next step is this. 1. Creating an XML element to connect the CSS file to the form. 2. Create an XML tag to include Styles in the form.. Maybe this will be the right decision. This will be bad form for developers, but supporting such a feature is the right solution. I've seen modules where CSS is plugged in inside a custom field. This is worse than connecting directly to XML. but Joomla does not know how to do this.

You can consider a new attribute for <field>, such as <field type="text" css="my_module.css"/>

@korenevskiy
Copy link
Contributor

korenevskiy commented Mar 9, 2021

@korenevskiy I guess the logic of parentclass is that this class is been added to the parent div of the field that the rule is creating. Unlike the class attribute, this does not add it to the control class div.

img-2021-03-09-13-35-32
it is not clear from the name of the attribute which parent we are talking about
Not intuitive and unclear.
.
But <field controlclass="span-4 stack"> -> <div class= "control-group span-4 stack">
And now control will have a width across the entire GRID.

@ciar4n
Copy link
Contributor Author

ciar4n commented Mar 9, 2021

@korenevskiy As this PR is already set to RTC, I'll be unlikely to edit it further. Feel free to create a PR against this code once/if this gets merged 👍

@rdeutz rdeutz merged commit 0625112 into joomla:4.0-dev Mar 10, 2021
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Mar 10, 2021
dgrammatiko pushed a commit to dgrammatiko/joomla-cms that referenced this pull request Mar 17, 2021
* [4.0] Field layout attribute

* revert display attribute

* inc joomla.content.options_default

* Revert "revert display attribute"

This reverts commit b1e13e1.

* rename to parentclass

* Update layouts/joomla/form/renderfield.php

Co-authored-by: Quy <quy@fluxbb.org>

* Update CalendarField.php

* Update CalendarField.php

* add since to all

* component configs

* Update article.xml

Co-authored-by: Quy <quy@fluxbb.org>
@chmst chmst mentioned this pull request Mar 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants