Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In some cases there are fields that have no instances. Then the field_ui fails to show them under "Add existing field" and it's not possible to create instances for these fields using the UI.
Steps to reproduce
- Create a field without an instance. For example using this code
$field = [ 'field_name' => 'field_no_instance, 'type' => 'text', ]; field_create_field($field);
- Navigate to "manage fields" on any code content type.
Expected result
The field shows up in "Add existing field".
Actual result
The field doesn't show up in "Add existing field".
Comment | File | Size | Author |
---|---|---|---|
#4 | 2869266-4-field_ui-show-fields-without-instances.patch | 2.92 KB | torotil |
Comments
Comment #2
torotil CreditAttribution: torotil at more onion commentedThis patch changes
field_ui_existing_field_options()
to first loop over all existing fields (field_read_fields()
) and then optionally add a better label and default widget by looping over existing field instancesComment #4
torotil CreditAttribution: torotil at more onion commentedThis time without the new array syntax.