You are here

public function RestfulCToolsPluginsDiscovery::getPlugins in RESTful 7

Overrides \RestfulDataProviderCToolsPlugins::getPlugins().

Remove the discovery plugin(s) from the list.

Overrides RestfulDataProviderCToolsPlugins::getPlugins

File

plugins/restful/ctools_plugins/1.0/RestfulCToolsPluginsDiscovery.class.php, line 45
Contains \RestfulCToolsPluginsDiscovery

Class

RestfulCToolsPluginsDiscovery
@file Contains \RestfulCToolsPluginsDiscovery

Code

public function getPlugins() {
  $plugins = parent::getPlugins();
  foreach ($plugins as $plugin_name => $plugin) {
    if (!$plugin['discoverable']) {
      unset($plugins[$plugin_name]);
    }
  }
  $request = $this
    ->getRequest();
  if (empty($request['all'])) {

    // Return only the last version of each resource.
    foreach ($plugins as $plugin_name => $plugin) {
      list($major_version, $minor_version) = static::getResourceLastVersion($plugin['resource']);
      if ($plugin['major_version'] != $major_version || $plugin['minor_version'] != $minor_version) {
        unset($plugins[$plugin_name]);
      }
    }
  }
  return $plugins;
}