You are here

function services_client_get_plugins in Services Client 7

Same name and namespace in other branches
  1. 7.2 services_client.plugins.inc \services_client_get_plugins()

Get list of all plugins

Parameters

string $type: Type of required plugins

int $services_version: Optionally can provide version of services module that have to be supported by plugin

bool $select_box: Whether should be returned back as options for select box in format PluginName => Human Readable

string $supports_key: Narrows the list to only plugins that support the given key

1 call to services_client_get_plugins()
services_client_plugin_options in plugins/export_ui/services_client.inc
Helper function to populate the second dropdown. This would normally be pulling data from the database.

File

./services_client.module, line 132
Services client module allows to push different types of objects on different types of events such as node_save, user_save to remote masters.

Code

function services_client_get_plugins($type, $select_box = FALSE, $supports_key = NULL) {
  $output = array();
  $plugins = ctools_get_plugins('services_client', $type);

  // Let other modules alter list of plugins
  drupal_alter('services_client_plugins', $plugins, $type);
  $output = $plugins;
  if ($select_box) {
    $options = array();
    foreach ($output as $key => $plugin) {
      if (isset($supports_key) && !in_array($supports_key, $plugin['supports'])) {

        // do not include this key in the select list
        continue;
      }
      $options[$key] = $plugin['name'];
    }
    $output = $options;
  }
  return $output;
}