function RulesElementMap::getUnIndexedElements

1 call to RulesElementMap::getUnIndexedElements()
RulesElementMap::index in ui/ui.core.inc
Makes sure each element has an assigned id.

File

ui/ui.core.inc, line 117

Class

RulesElementMap
Helper object for mapping elements to ids.

Code

protected function getUnIndexedElements($element, &$unindexed = array()) {
    // Remember unindexed elements.
    $id = $element->property('elementId');
    if (!isset($id)) {
        $unindexed[] = $element;
    }
    else {
        // Make sure $this->counter refers to the highest id.
        if ($id > $this->counter) {
            $this->counter = $id;
        }
        $this->index[$id] = $element;
    }
    // Recurse down the tree.
    if ($element instanceof RulesContainerPlugin) {
        foreach ($element as $child) {
            $this->getUnIndexedElements($child, $unindexed);
        }
    }
    return $unindexed;
}