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 situations you are rendering fields for a term which is not yet saved and is missing some properties. In my case, I use field_extrawidgets, with this patch: #1305268: Contents of a read-only field is hidden on the term/entity edit form, and thus cannot be edited.. When I open the term create form, I get notices and warnings because $entity->vid
is missing.
Comment | File | Size | Author |
---|---|---|---|
#4 | undefined_term_vid-i18n-2691553-4.patch | 774 bytes | MiroslavBanov |
#2 | undefined_term_vid-i18n-2691553-2.patch | 718 bytes | MiroslavBanov |
Comments
Comment #2
MiroslavBanov CreditAttribution: MiroslavBanov commentedI am adding an isset() check.
The
vocabulary_machine_name
property does exist, but I find it safer to just prevent the error with isset() check.This can also be quite easily reproduced without field_extrawidgets:
1. Create a vocabulary (test_vocab) with an additional text field
2. run the following code
You will get a couple of warnings for
array_flip(): Can only flip STRING and INTEGER values! entity.inc
. And this patch will remove the warnings.Comment #4
MiroslavBanov CreditAttribution: MiroslavBanov commentedCreated the patch from the sub-module for some reason. Trying again