function ContentEntityBase::__unset
Implements the magic method for unset().
File
- 
              core/
lib/ Drupal/ Core/ Entity/ ContentEntityBase.php, line 1147  
Class
- ContentEntityBase
 - Implements Entity Field API specific enhancements to the Entity class.
 
Namespace
Drupal\Core\EntityCode
public function __unset($name) {
  // Unsetting a field means emptying it.
  if ($this->hasField($name)) {
    $this->get($name)
      ->setValue([]);
  }
  else {
    unset($this->values[$name]);
  }
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.