#71293`foreign_record_defaults` is not stored when the field hidden
Description
You have the two tables tx_enterprise_domain_model_address with three different types of addresses (phone, email and postal). Per default the type select is visible in all types.
array(
'ctrl' => array(
[...]
'type' => 'type',
[...]
),
'types' => array(
'0' => array(
'showitem' => '
--palette--;;general,
--palette--;;postal,
--palette--;;phone,
[...]
'
),
'postal' => array(
'showitem' => '
--palette--;;general,
--palette--;;postal
'
),
'phone' => array(
'showitem' => '
--palette--;;general,
--palette--;;phone
'
),
'email' => array(
'showitem' => '
--palette--;;general,
--palette--;;email
'
),
[...]
),
'palettes' => array(
'general' => array(
'showitem' => '
type
'
),
'postal' => array(
'showitem' => '
street,
[...]
'
),
'phone' => array(
'showitem' => '
phone,
[...]
'
),
'email' => array(
'showitem' => '
email,
[...]
'
),
[...]
),
'columns' => array(
[...]
'type' => array(
[...]
'config' => array(
'type' => 'select',
'default' => 'postal',
'items' => array(
array(
'Postal',
'postal'
),
array(
'Phone',
'phone'
),
array(
'Email',
'email'
),
[...]
)
)
)
[...]
)
);
And you have the table tx_enterprise_domain_model_person with the two columns phones and emails. In phones the inline record address has no type select (see its foreign_types) but emails leaves this as configured in the inline record table above.
array(
[...]
'columns' => array(
[...]
'phones' => array(
[...]
'config' => array(
'type' => 'inline',
'foreign_table' => 'tx_enterprise_domain_model_address',
'foreign_types' => array(
'phone' => array(
'showitem' => '
--palette--;;phone
'
)
),
'foreign_record_defaults' => array(
'type' => 'phone'
),
[...]
)
),
'emails' => array(
[...]
'config' => array(
'type' => 'inline',
'foreign_table' => 'tx_enterprise_domain_model_address',
'foreign_record_defaults' => array(
'type' => 'email'
),
[...]
)
)
)
);
After creating a person and adding a new phone number and a email for that person, you see for each inline record the correct form; for phones this is only the input for a phone number, for emails this is the type select and a input for the email itself. But after saving the type value for the phones inline record is postal and not phone. So in this case foreign_record_defaults is only correctly stored when the corresponding field was rendered before. But the expectation would be that all values in foreign_record_defaults are stored in any case no matter if they rendered before or not.
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.