User tests: Successful: Unsuccessful:
Pull Request for Issue # .
FormField class allow get/set the rendering layouts: $field->renderLayout
and $field->renderLabelLayout
As for now it only possible to change $field->layout
.
Add following code somewhere, and run:
$t = new \Joomla\CMS\Form\Field\TextField();
$t->setup(new SimpleXMLElement('<field name="foobar" />'), '');
$t->renderLayout = 'foo';
$t->renderLabelLayout = 'bar';
var_dump($t->renderLayout, $t->renderLabelLayout);
Outputs:
joomla.form.renderfield
joomla.form.renderlabel
Outputs:
foo
bar
Please select:
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
Title |
|
hm, and @wilsonge what do you think about passing renderLayout
as option in to renderField:
joomla-cms/libraries/src/Form/FormField.php
Line 997 in 4e04c5f
It sometimes need to have a custom layout for "special form" while keeping default forms in default layout.
Only solution curently is to render it manualy with $field->input
and $field->label
. That is ignoring all features provided by renderField()
method.
I closing this for now, will re-do this later with renderField(['renderLayout' => 'foobar'])
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2024-01-24 09:13:34 |
Closed_By | ⇒ | Fedik | |
Labels |
Added:
Feature
Small
PR-5.1-dev
|
Honestly not sure I'm a fan of this. I think it's probably a bad idea that plugins would be able to override the output this directly. The field is supposed to determine how it renders data (the layout is strictly there to enable the field to get template overrides - typically for yootheme and other non-bootstrap based template clubs)