Hi.
Joomla 3.9.5
It's not possible to change the allowAdd attribute of the JFormField categoryedit to false.
In /administrator/component/com_categories/models/fields/categoryedit.php
line : 59 we set $this->allowAdd to blank or to a simplexmlelement
line : 344 if ($this->allowAdd)
{
Here we tests $this->allowAdd as booleen, so when it's an SimpleXMLElement (wich is generaly the case),
this test return always true.
So if we make a
$form->setFieldAttribute('catid','allowAdd','false');
This have no effect, and worse it is interpreted as true.
Regards
Always
Labels |
Added:
J3 Issue
|
Status | New | ⇒ | Information Required |
Hi Franz.
What do you want to know else ?
With x-debug i see that (see in my description above) that in line 344 of /administrator/component/com_categories/models/fields/categoryedit.php
$this->allowAdd is tested as booleen and as this variable is of type SimpleXMLElement, the condition is always true.
So a $form->setFieldAttribute('catid','allowAdd','false'); has no effect.
I do not see what I can explain in more detail.
Regards.
What do you want to know else ?
i'm calling Harald as Release Lead, i'm user no Dev.
I suggest to change in line 57 of /administrator/component/com_categories/models/fields/categoryedit.php
$this->allowAdd = isset($this->element['allowAdd']) ? $this->element['allowAdd'] : '';
by
$this->allowAdd = isset($this->element['allowAdd']) ? (bool)filter_var((((array)$this->element->attributes())['@attributes']['allowAdd']), FILTER_VALIDATE_BOOLEAN) : '';
This solve the problème.
Regards.
or
$this->allowAdd = isset($this->element['allowAdd']) ? (bool)filter_var((((array)$this->element->attributes())['@attributes']['allowAdd']), FILTER_VALIDATE_BOOLEAN) : false;
please do pr
Closed as having Pull Request.
Status | Information Required | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2019-04-13 09:50:10 |
Closed_By | ⇒ | franz-wohlkoenig |
@HLeithner can you please comment?