mirror of
https://github.com/processwire/processwire.git
synced 2025-08-13 18:24:57 +02:00
Update a non-wired WireArray to automatically inherit an added item's ProcessWire instance
This commit is contained in:
@@ -1892,6 +1892,8 @@ class WireArray extends Wire implements \IteratorAggregate, \ArrayAccess, \Count
|
||||
protected function trackAdd($item, $key) {
|
||||
if($key) {}
|
||||
if($this->trackChanges()) $this->itemsAdded[] = $item;
|
||||
// wire this WireArray to the same instance of $item, if it isn’t already wired
|
||||
if($this->_wire === null && $item instanceof Wire && $item->isWired()) $item->wire($this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user