You are here

function heartbeat_plugins_get_active_plugins in Heartbeat 7

Helper function to retrieve all active plugins.

Parameters

Boolean $include: Indicates whether the plugins needs to be loaded/included.

9 calls to heartbeat_plugins_get_active_plugins()
heartbeat_plugins_flag_default_flags in modules/heartbeat_plugins/heartbeat_plugins.module
Implements hook_flag_default_flags().
heartbeat_plugins_flag_definitions in modules/heartbeat_plugins/heartbeat_plugins.module
Implements of hook_flag_definitions().
heartbeat_plugins_form_alter in modules/heartbeat_plugins/heartbeat_plugins.module
Implements hook_form_alter().
heartbeat_plugins_get_plugin in modules/heartbeat_plugins/heartbeat_plugins.module
Helper function to retrieve an active plugin.
heartbeat_plugins_heartbeat_activity_delete in modules/heartbeat_plugins/heartbeat_plugins.module
Implements of hook_heartbeat_activity_delete().

... See full list

File

modules/heartbeat_plugins/heartbeat_plugins.module, line 500

Code

function heartbeat_plugins_get_active_plugins($include = FALSE) {
  $plugins =& drupal_static('heartbeat_plugins');
  if (!isset($plugins)) {
    $plugins = array();

    // Load from cache if possible.
    if ($object = cache_get('heartbeat_plugins')) {
      $plugins = $object->data;
    }
    else {
      ctools_include('export');
      foreach (ctools_export_crud_load_all('heartbeat_plugins') as $plugin) {
        if (empty($plugin->disabled)) {
          $plugins[] = $plugin;
        }
      }
      cache_set('heartbeat_plugins', $plugins);
    }
  }
  if (!empty($plugins)) {
    if ($include) {
      foreach ($plugins as $plugin) {

        // Load our plugin file.
        module_load_include('inc', 'heartbeat_plugins', 'plugins/' . $plugin->plugin_name);
      }
    }
  }
  return $plugins;
}