How do you check if a field is empty in Drupal 8

You, DrupalDrupal entity api
Back

This is easy with Drupal 8. We can use built in isEmpty method for this so following is an example of the usage.

$entity->get($fieldname)->isEmpty()
© Heshan Wanigasooriya.RSS

🍪 This site does not track you.