public function FieldChain::addField in Corresponding Entity References 7.3
Prepends a field instance to this chain. If $completed is passed, we'll try to find the parents of the instance and recurse upwards, building a tree of "routes" to the instance.
File
- field_object/
includes/ FieldChain.inc, line 52 - Contains the FieldChain class.
Class
- FieldChain
- @class A doubly linked list of FieldInstance objects.
Code
public function addField(FieldInstance $field, array &$completed = NULL) {
array_unshift($this->chain, $field);
$this
->__wakeup();
if (isset($completed)) {
$parents = $field
->getParents();
if ($parents) {
foreach ($parents as $parent) {
$branch = clone $this;
$branch
->addField($parent, $completed);
}
}
else {
$completed[] = $this;
}
}
}