You are here

protected function EventHandler::getPluginInstance in Services Client 7.2

Retrieve plugin instance by name and configuration.

Parameters

string $name: Class name.

array $config: Plugin configuration array.

Return value

object Plugin instance.

5 calls to EventHandler::getPluginInstance()
EntitySaveHandler::configForm in include/event.inc
Configuration form.
EntitySaveHandler::getMappedObject in include/event.inc
Retrieve object that should be send to remote site.
EventHandler::configForm in include/event.inc
Configuration form.
EventHandler::getPlugin in include/event.inc
Retrieve existing plugin.
EventHandler::isMatching in include/event.inc
Determine wheather entity is matching event conditions.

File

include/event.inc, line 199

Class

EventHandler
Event handler plugin.

Code

protected function getPluginInstance($name, $config, $uuid) {
  if (isset($this->plugin_instances[$uuid])) {
    return $this->plugin_instances[$uuid];
  }
  else {
    if (!class_exists($name)) {
      throw new Exception(t("Missing class @name when initializing plugin.", array(
        '@name' => $name,
      )));
    }
    $reflection = new ReflectionClass($name);
    $plugin = $reflection
      ->newInstanceArgs(array(
      $this->event,
      $config,
    ));
    $this->plugin_instances[$uuid] = $plugin;
    return $plugin;
  }
}