You are here

function hook_commerce_file_license_state_info in Commerce File 7

Defines states for use in grouping license statuses together to form a simple state machine.

A state is a particular phase in the life-cycle of a entity that is comprised of one or more statuses. In that regard, a state acts like a container for statuses with a default status per state. This is useful for categorizing and advancing from one state to the next without needing to know the particular status an entity will end up in.

The Commerce File module defines several states in its own implementation of this hook, commerce_file_commerce_file_license_state_info():

  • Denied: licenses that cannot be accessed by the owner
  • Allowed: licenses that can be accessed by the owner

The state array structure is as follows:

  • name: machine-name identifying the state using lowercase alphanumeric characters, -, and _
  • title: the translatable title of the state, used in administrative interfaces
  • description: a translatable description of the types of entities that would be in this state
  • weight: integer weight of the state used for sorting lists of states; defaults to 0
  • default_status: name of the default status for this state

Return value

An array of state arrays keyed by name.

1 function implements hook_commerce_file_license_state_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_state_info in includes/
Implements hook_commerce_file_license_state_info().
1 invocation of hook_commerce_file_license_state_info()
commerce_file_license_states in includes/
Returns an array of all the license states keyed by name.


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


function hook_commerce_file_license_state_info() {
  $states = array();
  $states['allowed'] = array(
    'name' => 'allowed',
    'title' => t('Allowed'),
    'description' => t('Licenses in this state can be accessed by the owner.'),
    'weight' => 0,
    'default_status' => 'active',
  return $states;