There's a plugin that adds a bunch of user profile fields and also dynamically changes fields visibility depending on current layout (i.e. makes certain fields hidden on registration layout). After a recent upgrade the dynamically set "hidden" attribute stopped working the way it did.
onContentPrepareForm()
function, apply "hidden" attribute to some field, e.g.$form->setFieldAttribute('dob', 'type', 'hidden', 'profile');
in my case, it's conditional
if ($form->getName() == 'com_users.registration') {
$form->setFieldAttribute('dob', 'type', 'hidden', 'profile');
}
a field would become hidden (on registration if conditional)
it is still visible in case the field is received through iteration:
foreach ($this->form->getFieldsets() as $fieldset) { // Iterate through the form fieldsets and display each one.
$fields = $this->form->getFieldset($fieldset->name);
...
foreach ($fields as $field) {// Iterate through the fields in the set and display them.
if ($field->hidden) {
echo $field->input;
} else echo $field->renderField();
}
}
But it is hidden if I add an extra step:
foreach ($this->form->getFieldsets() as $fieldset) { // Iterate through the form fieldsets and display each one.
$fields = $this->form->getFieldset($fieldset->name);
...
foreach ($fields as $f) {// Iterate through the fields in the set and display them.
$field = $this->form->getField($f->fieldname, $f->group);
if ($field->hidden) {
echo $field->input;
} else echo $field->renderField();
}
}
PHP 5.6.28
I believe the bug was introduced with J3.6.5 update
Status | New | ⇒ | Information Required |
Status | Information Required | ⇒ | Closed - No Reply |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-05-27 10:32:02 |
Closed_By | ⇒ | franz-wohlkoenig |
Set to "closed" on behalf of @franz-wohlkoenig by The JTracker Application at issues.joomla.org/joomla-cms/13807
This has been closed due to lack of response to the requests above – it can always be reopened in the future if it is updated.
@tgv604 can you confirm this Issue in latest staging?
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13807.