- Issue created by @ressa
- πΊπΈUnited States apmsooner
Ahh, thanks for the report. I need to check for the setting before comparison of value in:
$is_hidden = $settings['fields'][$name]['format_type'] === 'hidden' ?? FALSE;
Thats an easy fix. I'll have a patch up shortly.
- π©π°Denmark ressa Copenhagen
Cool, thanks! I forgot to add an important bit: "[...] if a field is empty", since it doesn't happen if all fields have values. (I added it in the Issue Summary)
- πΊπΈUnited States apmsooner
I am honestly not able to reproduce this. It shouldn't even get to that point if $items is empty. Assuming this is a multi-valued field, it seems like one of your items is for some reason not being considered empty. Is it just a: string, uri, and string_long subfield structure?
- πΊπΈUnited States apmsooner
What kind of entity is this field attached to or is it being used in layout builder or something?
- πΊπΈUnited States apmsooner
Its a mystery to me how to get to the error but the patch should at least fix it if you can try out and report back please.
- π©π°Denmark ressa Copenhagen
Could it be because it's a migration, and the fields are not set as
NULL
in the database? The fields are Text (long), URI and Integer, though it's hard to find a pattern ...Anyway, the patch works perfectly, and I no longer get the warnings. Thanks!
-
apmsooner β
committed 97719600 on 3.1.x
Issue #3515361 by apmsooner, ressa: Warning: Undefined array key in...
-
apmsooner β
committed 97719600 on 3.1.x
- πΊπΈUnited States apmsooner
I don't think thats the issue cause the loop was just going over the settings which is configuration but anyhow its fixed and merged. Thanks!
- π©π°Denmark ressa Copenhagen
Strange, but awesome that it got fixed so fast, I really appreciate it!
- π©π°Denmark ressa Copenhagen
I just tried replicating this with Custom Field 3.1.5 in a Drupal 11 installation (original issue in D10), also with DDEV PHP 8.3, and get the same warnings. Empty field or not makes no difference, like you write - it's a config thing.
These are the two config files:
field.field.node.article.field_journal.yml
uuid: 5a41cd90-8fe4-4554-bb9c-b2a14a45aa5a langcode: en status: true dependencies: config: - field.storage.node.field_journal - node.type.article module: - custom_field id: node.article.field_journal field_name: field_journal entity_type: node bundle: article label: Journal description: '' required: false translatable: false default_value: { } default_value_callback: '' settings: add_more_label: '' field_settings: value: type: text weight: 0 check_empty: false widget_settings: label: Name translatable: false settings: description: '' description_display: after size: 60 placeholder: '' maxlength: 255 maxlength_js: false prefix: '' suffix: '' required: false journal_comment: type: text weight: 0 check_empty: false widget_settings: label: 'Journal comment' translatable: false settings: description: '' description_display: after size: 60 placeholder: '' maxlength: 255 maxlength_js: false prefix: '' suffix: '' required: false journal_link: type: url weight: 0 check_empty: false widget_settings: label: 'Journal link' translatable: false settings: description: '' description_display: after size: 60 placeholder: '' required: false link_type: 17 field_prefix: default field_prefix_custom: '' field_type: custom
field.storage.node.field_journal.yml
uuid: c6c261fe-853e-4f69-aba3-77311c275992 langcode: en status: true dependencies: module: - custom_field - node id: node.field_journal field_name: field_journal entity_type: node type: custom settings: columns: value: name: value type: string max_length: '255' unsigned: 0 precision: '10' scale: '2' size: normal datetime_type: datetime journal_comment: name: journal_comment type: string max_length: '255' unsigned: 0 precision: '10' scale: '2' size: normal datetime_type: datetime journal_link: name: journal_link type: uri max_length: '255' unsigned: 0 precision: '10' scale: '2' size: normal datetime_type: datetime module: custom_field locked: false cardinality: 1 translatable: true indexes: { } persist_with_no_fields: false custom_storage: false