You are here

class HeartbeatPluginWrapper in Heartbeat 7

Class wrapper for the plugins.

Hierarchy

Expanded class hierarchy of HeartbeatPluginWrapper

1 string reference to 'HeartbeatPluginWrapper'
heartbeat_plugins_schema in modules/heartbeat_plugins/heartbeat_plugins.install
Implements hook_schema().

File

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

View source
class HeartbeatPluginWrapper extends HeartbeatCtoolsObject implements iHeartbeatPluginWrapper {
  public $plugin_name = '';
  public $label = '';
  public $settings = array();
  public $error = array();

  /**
   * Get the real plugin object.
   */
  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;
  }

}

Members