User tests: Successful: Unsuccessful:
Pull Request for Issue #15977
Added a condition to cover a use case that was possible before 3.7.0. It is wasting time to discuss if this is a use case that was intended, I think it wasn't. Anyway this patch with allow the use case.
We can do JFormObject manipulations in the template, this is easier for testing. So in a vanilla Joomla installation:
<?xml version="1.0" encoding="utf-8"?>
<form>
<fields name="custom_fields" />
</form>
// create and add a field
$form = $this->form;
$xml = '<field type="text" name="test-field" label="Test field" />';
$form->setField(new \simpleXmlElement($xml), 'custom_fields');
echo "#<div style='text-align:left;font_size:1.2em;'><pre>";
print_r($form->getField('test-field', 'custom_fields'));
echo "</pre></div>#";
You don't see output for the field internals
You see output for the field internals
Don't expect to see the field in the form, that's not the way forms have to be defined so that the output can be dynamically created.
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
Title |
|
||||||
Labels |
Added:
?
|
If you can get it done by this evening we can squeeze it into the 3.7.1 release next week :) (Release Candidate cutoff is 5.30pm GMT this evening)
After patch I get
JFormFieldText Object
(
[type:protected] => Text
[maxLength:protected] => 0
[inputmode:protected] =>
[dirname:protected] =>
[layout:protected] => joomla.form.field.text
[description:protected] =>
[hint:protected] =>
[autocomplete:protected] => on
[spellcheck:protected] => 1
[autofocus:protected] =>
[element:protected] => SimpleXMLElement Object
(
[@attributes] => Array
(
[type] => text
[name] => test-field
[label] => Test field
)
)
[form:protected] => JForm Object
(
[data:protected] => Joomla\Registry\Registry Object
(
[data:protected] => stdClass Object
(
)
[initialized:protected] =>
[separator] => .
)
[errors:protected] => Array
(
)
[name:protected] => com_users.remind
[options:protected] => Array
(
[control] => jform
)
[xml:protected] => SimpleXMLElement Object
(
[fields] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => custom_fields
)
[field] => SimpleXMLElement Object
(
[@attributes] => Array
(
[type] => text
[name] => test-field
[label] => Test field
)
)
)
)
[repeat] =>
)
[formControl:protected] => jform
[hidden:protected] =>
[translateLabel:protected] => 1
[translateDescription:protected] => 1
[translateHint:protected] => 1
[id:protected] => jform_custom_fields_test_field
[input:protected] =>
[label:protected] =>
[multiple:protected] =>
[repeat] =>
[pattern:protected] =>
[name:protected] => jform[custom_fields][test-field]
[fieldname:protected] => test-field
[group:protected] => custom_fields
[required:protected] =>
[disabled:protected] =>
[readonly:protected] =>
[validate:protected] =>
[value:protected] =>
[default:protected] =>
[size:protected] => 0
[class:protected] =>
[labelclass:protected] =>
[onchange:protected] =>
[onclick:protected] =>
[showon:protected] =>
[renderLayout:protected] => joomla.form.renderfield
[renderLabelLayout:protected] => joomla.form.renderlabel
)
Is that succesful?
yes, the following part is important
[fields] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => custom_fields
)
[field] => SimpleXMLElement Object
(
[@attributes] => Array
(
[type] => text
[name] => test-field
[label] => Test field
)
)
)
I have tested this item
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
RTC
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-05-12 16:01:48 |
Closed_By | ⇒ | wilsonge | |
Labels |
Added:
?
|
Thanks for the patch. I will test it as soon as possible.