You are here

function commerce_license_types_allowed_values in Commerce License 7

Allowed values callback for license types.

1 call to commerce_license_types_allowed_values()
commerce_license_field_widget_form_alter in ./commerce_license.module
Implements hook_field_widget_form_alter().
1 string reference to 'commerce_license_types_allowed_values'
commerce_license_configure_product_types in ./commerce_license.module
Ensures that the provided product types have the required license fields.

File

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

Code

function commerce_license_types_allowed_values($field, $instance, $entity_type, $entity) {
  $types =& drupal_static(__FUNCTION__, array());
  if (empty($types)) {
    foreach (commerce_license_get_type_plugins() as $plugin_name => $plugin_info) {
      if (empty($plugin_info['no ui'])) {
        $types[$plugin_name] = $plugin_info['title'];
      }
    }

    // Allow the list to be altered.
    drupal_alter('commerce_license_types_list', $types, $entity);
  }
  return $types;
}