You are here

public function UltimateCronJob::getPluginSettings in Ultimate Cron 7.2

Get plugin settings.

Parameters

string $plugin_type: The plugin type.

Return value

array Settings for the given plugin type.

1 call to UltimateCronJob::getPluginSettings()
UltimateCronJob::getSettings in ./ultimate_cron.job.inc
Get job settings.

File

./ultimate_cron.job.inc, line 212
Job class for Ultimate Cron.

Class

UltimateCronJob
Class for handling cron jobs.

Code

public function getPluginSettings($plugin_type) {
  if (isset($this->pluginSettings[$plugin_type])) {
    return $this->pluginSettings[$plugin_type];
  }
  ctools_include('plugins');
  $plugin_types = ctools_plugin_get_plugin_type_info();
  $plugin_info = $plugin_types['ultimate_cron'][$plugin_type];
  $static = $plugin_info['defaults']['static'];
  $class = $static['class'];
  $settings = $this->settings[$plugin_type];
  if (!$class::$multiple) {
    $plugin = $this
      ->getPlugin($plugin_type);
    if (empty($settings[$plugin->name])) {
      $settings[$plugin->name] = array();
    }
    $settings['name'] = $plugin->name;
    $settings[$plugin->name] += $plugin
      ->getDefaultSettings($this);
  }
  else {
    $plugins = _ultimate_cron_plugin_load_all($plugin_type);
    foreach ($plugins as $name => $plugin) {
      if (empty($settings[$name])) {
        $settings[$name] = array();
      }
      if ($plugin
        ->isValid($this)) {
        $settings[$name] += $plugin
          ->getDefaultSettings($this);
      }
    }
  }
  $this->pluginSettings[$plugin_type] = $settings;
  return $settings;
}