Skip to content
Snippets Groups Projects

Fix __isset() and __unset()

Closed Sascha Grossenbacher requested to merge issue/drupal-3495531:3495531-bc-layer-missing into 11.x
3 files
+ 43
0
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -1145,6 +1145,9 @@ public function __set($name, $value) {
* Implements the magic method for isset().
*/
public function __isset($name) {
if ($name == 'original') {
return parent::__isset('original');
}
// "Official" Field API fields are always set. For non-field properties,
// check the internal values.
return $this->hasField($name) ? TRUE : isset($this->values[$name]);
@@ -1154,6 +1157,9 @@ public function __isset($name) {
* Implements the magic method for unset().
*/
public function __unset($name) {
if ($name == 'original') {
parent::__unset('original');
}
// Unsetting a field means emptying it.
if ($this->hasField($name)) {
$this->get($name)->setValue([]);
Loading