You are here

function commerce_license_get_type_plugins in Commerce License 7

Get the available type plugins.

2 calls to commerce_license_get_type_plugins()
commerce_license_entity_info in ./commerce_license.module
Implements hook_entity_info().
commerce_license_types_allowed_values in ./commerce_license.module
Allowed values callback for license types.

File

./commerce_license.module, line 109
Provides a framework for selling access to local or remote resources.

Code

function commerce_license_get_type_plugins() {
  ctools_include('plugins');
  $plugins = ctools_get_plugins('commerce_license', 'license_type');
  foreach ($plugins as $key => $plugin) {
    if (!class_exists($plugin['class'])) {

      // Invalid class specified.
      unset($plugins[$key]);
      continue;
    }
    $r = new ReflectionClass($plugin['class']);
    if (!$r
      ->hasMethod('isValid') || !call_user_func(array(
      $plugin['class'],
      'isValid',
    ))) {

      // Invalid plugin specified.
      unset($plugins[$key]);
      continue;
    }
  }
  uasort($plugins, 'ctools_plugin_sort');
  return $plugins;
}