If you edit any item that includes both following layouts (which most do) the id field is included twice:
joomla-cms/layouts/joomla/edit/global.php
Lines 26 to 38 in baf88ba
joomla-cms/layouts/joomla/edit/publishingdata.php
Lines 15 to 26 in baf88ba
The id field is also hidden by the global layout which causes it to be hidden in both the global and publishingdata renders.
joomla-cms/layouts/joomla/edit/global.php
Line 41 in baf88ba
id was supposed to be hidden on the global layout but still be displayed on the publishingdata layout.id must be rendered at least once.id shown as it used to be.If you remove id from the $hiddenFields[] then you get the following (i.e. the id is now shown twice in the edit contact form):
The id field is rendered twice but both instances are hidden.
| Setting | Value |
|---|---|
| PHP Built On | Windows NT E6540 10.0 build 19041 (Windows 10) AMD64 |
| Database Type | mysql |
| Database Version | 5.5.5-10.4.10-MariaDB |
| Database Collation | utf8mb4_unicode_ci |
| Database Connection Collation | utf8mb4_general_ci |
| PHP Version | 7.3.12 |
| Web Server | Apache/2.4.41 (Win64) OpenSSL/1.1.1c PHP/7.3.12 |
| WebServer to PHP Interface | apache2handler |
| Joomla! Version | Joomla! 3.9.22 Stable [ Amani ] 6-October-2020 15:00 GMT |
| Joomla! Platform Version | Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT |
| User Agent | Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:83.0) Gecko/20100101 Firefox/83.0 |
a good example file is:
I do not know if this is present in Joomla 4
| Labels |
Added:
?
|
||
| Title |
|
||||||
This should be closed as expected behaviour
| Status | New | ⇒ | Closed |
| Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-11-27 22:02:33 |
| Closed_By | ⇒ | Quy |
cannot be expected behaviour. id field is always hidden so cannot be displayed in publishingdta fields.
if present in global why have it present in publishingdata?
easy to fix, after rendering the id filed in glibal removr it from hidden fileds.
@shoulders please read the link I posted
@brianteeman i did read the link. it says the id is needed for for something, my issue is the id field is rendered twice and for both instances is hidden.
is it worth me having a play with some code so i can show you what i mean if i can get it working?
tar
The following code might be left in for legacy reasons, I am not sure. It seems to do nothing and always create an empty array.
contact model --> "getHidden_fields" method does not existsCMSObject class ( --> "hidden_fields" property does not existjoomla-cms/layouts/joomla/edit/global.php
Line 40 in 55f78da
id field from the publishingdata layout, people might or might not use this if it was visible.joomla-cms/layouts/joomla/edit/global.php
Lines 51 to 66 in 55f78da
foreach ($fields as $field)
{
foreach ((array) $field as $f)
{
if ($form->getField($f))
{
if (in_array($f, $hiddenFields))
{
$currentFieldType = $form->getFieldAttribute($f, 'type');
$form->setFieldAttribute($f, 'type', 'hidden');
}
$html[] = $form->renderField($f);
if (in_array($f, $hiddenFields))
{
$form->setFieldAttribute($f, 'type', $currentFieldType);
unset($currentFieldType);
}
break;
}
}
}
Please see #22166