Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 292843

field_tags is missing in $entity if field is empty on "node/add"

$
0
0

I have the issue #1923328: Notice: Undefined property: stdClass::$field_tags in linkchecker that I do not understand yet and I need some help about this field issue.

If a new article node is added (via node/add) the field_tags field is completely missing in the $entity. This seems not happen if you edit the node later (node/edit). I get a notice for line $entity->$field['field_name'];, but I think this field_name must always exists in the entity. I cannot find any other example in core that handle or workaround this type of notices.

Code example:

<?php
 
// Collect the fields from this entity_type and bundle.
 
foreach (field_info_instances($entity_type, $bundle_name) as $field_name => $instance) {
   
$field = field_info_field($field_name);
   
// #1923328: field_name array may be missing in $entity if field is empty.
   
$entity_field = $entity->$field['field_name'];

  ...
?>

What's wrong here?


Viewing all articles
Browse latest Browse all 292843

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>