function RulesExtendable::rebuildCache

Allows items to add something to the rules cache.

1 call to RulesExtendable::rebuildCache()
RulesAbstractPlugin::rebuildCache in includes/rules.core.inc
Add in the data provided by the info hooks to the cache.
1 method overrides RulesExtendable::rebuildCache()
RulesAbstractPlugin::rebuildCache in includes/rules.core.inc
Add in the data provided by the info hooks to the cache.

File

includes/rules.core.inc, line 389

Class

RulesExtendable
Base class for RulesExtendables.

Code

public function rebuildCache(&$itemInfo, &$cache) {
    // Speed up setting up items by caching the faces methods.
    if (!empty($itemInfo['extenders'])) {
        // Apply extenders and overrides.
        $itemInfo += array(
            'overrides' => array(),
        );
        foreach ($itemInfo['extenders'] as $face => $data) {
            $data += array(
                'file' => array(),
            );
            if (isset($data['class'])) {
                $this->extendByClass($face, $data['class'], $data['file']);
            }
            elseif (isset($data['methods'])) {
                $this->extend($face, $data['methods'], $data['file']);
            }
        }
        foreach ($itemInfo['overrides'] as $data) {
            $data += array(
                'file' => array(),
            );
            $this->override($data['methods'], $data['file']);
        }
        $itemInfo['faces_cache'] = array(
            $this->facesMethods,
            $this->facesIncludes,
            $this->faces,
        );
        // We don't need that any more.
        unset($itemInfo['extenders'], $itemInfo['overrides']);
    }
}