You are here

public function HeartbeatPluginWrapper::getPlugin in Heartbeat 7

Get the real plugin object.

Overrides iHeartbeatPluginWrapper::getPlugin

File

modules/heartbeat_plugins/includes/heartbeat_plugin.inc, line 37

Class

HeartbeatPluginWrapper
Class wrapper for the plugins.

Code

public function getPlugin() {
  $class = 'Heartbeat' . $this->plugin_name . 'Plugin';
  module_load_include('inc', $this->module, 'plugins/' . $this->plugin_name);
  if (class_exists($class)) {
    $plugin = new $class($this->label, $this->settings);
    $plugin
      ->addSettings(array(
      'plugin_name' => $this->plugin_name,
    ));
  }
  else {
    $plugin = NULL;
    $this->error = array(
      'critical' => t('No class found for @class', array(
        '@class' => $class,
      )),
    );
  }
  return $plugin;
}