API:invokeEvent
From MODx Wiki
API Function Definition:
invokeEvent
- Versions
- > 0.6.0
- Return Values
- Success: Values of each plugin
- Fail: bool false
- Data Type
- array
- Object Hierarchy
- DocumentParser
array invokeEvent(string $evtName[, array $extParams]);
Executes plugins based on $evtName. See System Events for a list of defined events for $evtName.
Examples
This is not an API Function and requires extensive knowledge of the MODx core in order to be used correctly. Use of this function in areas other than the core code is discouraged and the team may provide little or no help on the use of this function.
Related Functions
Function Source
| File: | manager/includes/document.parser.class.inc.php |
|---|---|
| Line: | 2244 |
if (!$evtName) return false; return false; $el= $this->pluginEvent[$evtName]; if ($numEvents > 0) for ($i= 0; $i < $numEvents; $i++) { // start for loop $pluginName= $el[$i]; // reset event object $e= & $this->Event; $e->_resetEventObject(); $e->name= $evtName; $e->activePlugin= $pluginName; // get plugin code $pluginCode= $this->pluginCache[$pluginName]; $pluginProperties= $this->pluginCache[$pluginName . "Props"]; } else { $sql= "SELECT * FROM " . $this->getFullTableName("site_plugins") . " WHERE name='" . $pluginName . "' AND disabled=0;"; $result= $this->dbQuery($sql); if ($this->recordCount($result) == 1) { $row= $this->fetchRow($result); $pluginCode= $this->pluginCache[$row['name']]= $row['plugincode']; $pluginProperties= $this->pluginCache[$row['name'] . "Props"]= $row['properties']; } else { $pluginCode= $this->pluginCache[$pluginName]= "return false;"; $pluginProperties= ''; } } // load default params/properties $parameter= $this->parseProperties($pluginProperties); // eval plugin $this->evalPlugin($pluginCode, $parameter); if ($e->_output != "") $results[]= $e->_output; if ($e->_propagate != true) break; } $e->activePlugin= ""; return $results;