When the Profile module is installed, it introduces the profile entity type, which initially has no bundles or fields.
The Views Entity Form Field moduleโs hook_views_data_alter() calls array_keys() on $bundle_info[$entity_type_id].
At that stage, $bundle_info['profile'] is NULL, causing the fatal error:
Uncaught PHP Exception TypeError: "array_keys(): Argument #1 ($array) must be of type array, null given"
Install Profile module.
Without creating any Profile types/fields, enable Views Entity Form Field.
Observe site crash with above error.
The code directly calls:
'bundles' => array_keys($bundle_info[$entity_type_id]),
without verifying if $bundle_info[$entity_type_id]
exists or is an array.
The module should gracefully skip entity types with no bundle info, instead of throwing a TypeError.
Wrap the array_keys() call with a check:
// Add submit button for row.
if (isset($bundle_info[$entity_type_id]) && is_array($bundle_info[$entity_type_id])) {
$data[$views_table]['form_field_submit_row']['field'] = [
'title' => t('Form field: Submit button'),
'help' => t('Add a submit button to the row.'),
'id' => 'entity_form_field',
'bundles' => array_keys($bundle_info[$entity_type_id]),
'entity_type' => $entity_type_id,
'field_name' => 'form_field_submit_row',
];
}
Needs review
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.