You are here

function hook_commerce_file_license_info in Commerce File 7

Defines access limit settings for Commerce File fields and Licenses

The limit array structure is as follows:

  • name: machine-name identifying the limit using lowercase alphanumeric characters, -, and _
  • title: the translatable title of the limit, used in administrative interfaces
  • base_element: the base form array for the limit setting,
    • property_info: the info array defining the metadata about the limit setting,

      • In addition to hook_entity_property_info():

        • 'default_value': A default value to be used for the setting
        • 'zero_value': The value that represents Zero/Empty to this setting
        • 'aggregated': TRUE or FALSE. TRUE if the setting's values should be aggregated across multiple fields, licenses, etc.
        • 'inheritable': TRUE or FALSE. TRUE if the setting should inherit it's value from the field or instance settings if a value is not entered.

Return value

An array of limit arrays keyed by name.

See also

http://api.drupal.org/api/drupal/developer--topics--forms_api_reference....

hook_entity_property_info()

1 function implements hook_commerce_file_license_info()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

commerce_file_commerce_file_license_info in ./commerce_file.commerce.inc
Implements hook_commerce_file_license_info().
3 invocations of hook_commerce_file_license_info()
commerce_file_modules_enabled in ./commerce_file.module
Implements hook_modules_enabled().
_commerce_file_collate_license_info in ./commerce_file.module
Store information about license properties
_commerce_file_license_invoke_callback in ./commerce_file.module
Invoke a callback for a license property

File

./commerce_file.api.php, line 144
Hooks provided by the Commerce File module.

Code

function hook_commerce_file_license_info() {
  $limits = array();
  $limits['download_limit'] = array(
    'name' => 'download_limit',
    'title' => t('Download Limit'),
    'base_element' => array(
      '#type' => 'commerce_file_limit_integer',
      '#title' => t('# of Downloads'),
    ),
    'property info' => array(
      'type' => 'integer',
      'label' => t('The number of downloads allowed'),
      'description' => t('The number of downloads allowed for this file.'),
      'default_value' => 10,
    ),
  );
  return $limits;
}