User tests: Successful: Unsuccessful:
Pull Request for PR #13069.
The label of the field is show in the table layout of the subform field as column header and then inline before the input field
This PR shows the label beside the input field only when the fields itself should be grouped by its groups.
Put the following XML code into the file administrator/components/com_content/models/forms/article.xml after line 162 (inside the basic fieldset in the attribs tag).
<field name="demo" type="subform" label="Subform" multiple="true" layout="joomla.form.field.subform.repeatable-table">
<form>
<field name="name"
label="Name"
size="30" type="text" />
<field name="value"
label="Value"
size="30" type="text" />
</form>
</field>
The labels should not be shown in the cell, like
Status | New | ⇒ | Pending |
Category | ⇒ | Layout |
Easy | No | ⇒ | Yes |
now I remember why was need $field->renderField()
, it need for showon
feature,
maybe we can do something like $field->renderField(array('label' => false))
,
but cannot check currently
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
Rtc
please hold on,
need to test showon
feature,
for it can use xml from #12511 with layout="joomla.form.field.subform.repeatable-table"
or:
<field name="items" type="subform" multiple="true" label="Subform Field"
layout="joomla.form.field.subform.repeatable-table" >
<form>
<field name="type" type="list" default="0" label="Type" >
<option value="0">Small</option>
<option value="1">Medium</option>
<option value="2">Large</option>
</field>
<field name="something" type="text"
label="Show when Type=Large" showon="type:2" />
</form>
</field>
I cannot currently, maybe this evening or tomorrow
Milestone |
Added: |
Status | Ready to Commit | ⇒ | Pending |
Milestone |
Removed: |
hm, $field->renderField(array('hiddenLabel' => true));
partially do the thing,
but default Joomla! styling add .form-horizontal .controls {margin-left: 180px;}
for input.
No idea what the best solution here
looks as good idea
Can this being tested again, with the following XML code, thanks!!
<field name="items" type="subform" multiple="true" label="Subform Field"
layout="joomla.form.field.subform.repeatable-table" >
<form>
<field name="type" type="list" default="0" label="Type" >
<option value="0">Small</option>
<option value="1">Medium</option>
<option value="2">Large</option>
</field>
<field name="something" type="text"
label="Show when Type=Large" showon="type:2" />
</form>
</field>
The show on functionality should work as well.
I have tested and it not realy work, @ralain are right,
but there one more thing, this code add CSS multiple times.
So maybe better place:
JFactory::getDocument()->addStyleDeclaration(
'.subform-repeatable-group[data-base-name="' . $fieldname . '"] .controls { margin-left: 0px }'
);
in the repeatable-table.php somewhere after this line repeatable-table.php#L62
Other possible solution is to add specific class to <div class="subform-repeatable-wrapper subform-table-layout">
and use CSS file to styling:
<div class="subform-repeatable-wrapper subform-table-layout subform-table-sublayout-<?php echo $sublayout; ?>">
and in css:
.subform-table-sublayout-section .controls { margin-left: 0px }
Other possible solution is to add specific class to
<div class="subform-repeatable-wrapper subform-table-layout">
and use CSS file to stylig.
Indeed, I would personally prefer a single global css rule over the embedded styles, if possible.
Changed to your suggestion, thanks for your help, much appreciated.
only, please move addStyleDeclaration()
in to the repeatable-table.php
somewhere after this line repeatable-table.php#L62 , because in current place it will be added multiple times
Done, should work now
Can we have another round of testing please. Thanks.
Milestone |
Added: |
I have tested this item
I have tested this item
Milestone |
Removed: |
Status | Pending | ⇒ | Ready to Commit |
RTC
Milestone |
Added: |
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-12-23 16:57:35 |
Closed_By | ⇒ | zero-24 | |
Labels |
Added:
?
|
Merged thanks
I have tested this item✅ successfully on eac64ae
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13093.