You are here

function ultimate_cron_ctools_plugin_instance in Ultimate Cron 7.2

Get plugin instance.

Parameters

string $type: Type of the plugin (settings, scheduler, launcher, logger).

Return value

object The instance of the plugin (singleton).

1 call to ultimate_cron_ctools_plugin_instance()
_ultimate_cron_plugin_load_all in ./ultimate_cron.module
Load all callback for plugins.

File

./ultimate_cron.module, line 224

Code

function ultimate_cron_ctools_plugin_instance($type, $plugin) {
  static $cache;
  if (!isset($cache[$plugin['name']])) {
    $cache[$plugin['name']] = ctools_plugin_get_class($plugin, 'handler');
  }
  if (isset($cache[$plugin['name']]) && class_exists($cache[$plugin['name']])) {
    $class = $cache[$plugin['name']];
    return $class::factory($class, $type, $plugin);
  }
  else {
    return NULL;
  }
}