I'm creating my custom Field extending the clasic JFormField like this:
class JFormFieldExtension extends JFormField {
protected $type = 'extension';
// Constructor
public function __construct(\Joomla\CMS\Form\Form $form = null)
{
parent::__construct($form);
JLog::add('************** JFormFieldExtension *****************', JLog::INFO, 'my_comp');
JLog::add('* CONSTRUCT ====>'.$this->element['name'].'<=====', JLog::INFO, 'my_comp');
}
public function getInput()
{
JLog::add('************** JFormFieldExtension *****************', JLog::INFO, 'my_comp');
JLog::add('* getInput ====>'.$this->element['name'].'<=====', JLog::INFO, 'my_comp');
}
With this code above, I get the following output:
2021-12-27T20:53:48+00:00 INFO 172.18.0.1 my_comp ************** JFormFieldExtension *****************
2021-12-27T20:53:48+00:00 INFO 172.18.0.1 my_comp * CONSTRUCT ====><=====
2021-12-27T20:53:48+00:00 INFO 172.18.0.1 my_comp ************** JFormFieldExtension *****************
2021-12-27T20:53:48+00:00 INFO 172.18.0.1 my_comp * getInput ====>field_name<=====
Question is: Why I get the $this->element['name'] inside the getInput() function, but not inside the __construct() ?