Skip to main content
Rollback to Revision 1 - Edit approval overridden by post owner or moderator
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

@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->hasField('field_your_field') && !$node->get('field_your_field')->isEmpty() ) {
 //... do something
}

@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->hasField('field_your_field') && !$node->get('field_your_field')->isEmpty() ) {
 //... do something
}

@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->hasField('field_your_field') && !$node->get('field_your_field')->isEmpty(){

}

@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->hasField('field_your_field') && !$node->get('field_your_field')->isEmpty() ) {
 //... do something
}

@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->hasField('field_your_field') && !$node->get('field_your_field')->isEmpty(){

}

@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->hasField('field_your_field') && !$node->get('field_your_field')->isEmpty() ) {
 //... do something
}
Source Link

@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->hasField('field_your_field') && !$node->get('field_your_field')->isEmpty(){

}