Each field must be created using XML or using PHP.
But this text field cannot be created using PHP.
Examples:
1.<field name="user" type="text"/>
2.
$textfield = Joomla\CMS\Form\FormHelper::loadFieldType('text');
$textfield->name = 'user';
$textfield->renderField();
This not working.
instead of this method, you can use another method
$textfield->render($textfield->renderLayout,[]);
It doesn't work either.
These methods call the text field method $textfield->getLayoutData()
Inside this method there is a method call $textfield->getOptions()
And inside this method, data is collected from $textfield->element
which has the type SimpleXMLElement.
This functionality should be called in the $textfield->Setup()
method.
But it is not called there, but is called when called ->renderField(); and ->render().
Thus, it is not possible to create fields in PHP.
foreach ($this->element->children() as $option)
Of course, this can be solved with crutches and props by creating a separate pseudo element with the SimpleXMLElement type. or by creating a Layout object separately from the text field object. But this is not normal at all. This is NOT observed in other fields. Moreover, the text field is the base class for many other fields. It is necessary to transfer the call $textfield->getOptions()
to the method $textfield->Setup()
Labels |
Added:
No Code Attached Yet
|
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2022-01-16 20:59:19 |
Closed_By | ⇒ | richard67 |
Closing as there is a pull request.