You are here

function _commerce_file_license_invoke_callback in Commerce File 7

Invoke a callback for a license property

3 calls to _commerce_file_license_invoke_callback()
CommerceFileLicenseEntity::get_limit_check_access in includes/commerce_file_license.entity.inc
Returns check access for a given limit property
CommerceFileLicenseEntity::get_limit_current_value in includes/commerce_file_license.entity.inc
Returns current value for a given limit property
CommerceFileLicenseEntity::get_limit_remaining_value in includes/commerce_file_license.entity.inc
Returns remaining value for a given limit property

File

./commerce_file.module, line 494
Provides integration of file licenses with Commerce

Code

function _commerce_file_license_invoke_callback($callback, $property) {

  // extract arguments
  $args = func_get_args();
  array_shift($args);
  array_shift($args);

  // get license info
  $info = _commerce_file_collate_license_info();
  if (isset($info[$property]) && isset($info[$property]['callbacks']) && !empty($info[$property]['callbacks'][$callback])) {

    // load module implements for info hook to allow callbacks in the same file
    module_implements('commerce_file_license_info');

    // call function and return
    $func = $info[$property]['callbacks'][$callback];
    if (function_exists($func)) {
      return call_user_func_array($func, $args);
    }
  }
}