How do I check the value of a field if its empty?
@vinhd proposition is correct, by the way you can also use the isEmpty() method from the field list interface. It can be more adapted for complex field types.
if ( $node-&gt;hasField('field_your_field') &amp;&amp; !$node-&gt;get('field_your_field')-&gt;isEmpty() ) {
 //... do something
}