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

"value" property can not be set directly on DateTimeItems

$
0
0

Date fields can be programmatically added like this:

$entity->get($field_name)->offsetGet(0)->setValue(array($iso_date));
// or
$entity->get($field_name)->offsetGet(0)->setValue(array('value' =>$iso_date));

But there is an exception when they are added like this:
$entity->get($field_name)->offsetGet(0)->get('value')->setValue($iso_date);

This works for text fields, so I would expect it to work for all fields.

Viewing all articles
Browse latest Browse all 293238

Trending Articles



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