You are here

function uc_file_rules_data_info in Ubercart 8.4

Same name and namespace in other branches
  1. 7.3 uc_file/uc_file.rules.inc \uc_file_rules_data_info()

Implements hook_rules_data_info().

An entity is defined in order to get file expiration(s) down to token in the email.

File

uc_file/uc_file.rules.inc, line 16
Rules hooks and functions for uc_file.module.

Code

function uc_file_rules_data_info() {
  $data['uc_file_expiration'] = [
    'label' => t('Ubercart file expiration(s)'),
    'wrap' => TRUE,
    'property info' => [
      'fuid' => [
        'type' => 'integer',
        'label' => t('File-user ID'),
        'description' => t('Primary key for user permission to download a file.'),
      ],
      'fid' => [
        'type' => 'integer',
        'label' => t('File ID'),
        'description' => t('The file that may be downloaded.'),
      ],
      'file' => [
        'type' => 'file',
        'label' => t('File'),
        'description' => t('The file that may be downloaded.'),
        'getter callback' => 'uc_file_get_expiration_properties',
        'setter callback' => 'uc_file_set_expiration_properties',
      ],
      'uid' => [
        'type' => 'integer',
        'label' => t('User ID'),
        'description' => t('The user account ID.'),
      ],
      'user' => [
        'type' => 'user',
        'label' => t('User'),
        'description' => t('The user account that may download the file.'),
        'getter callback' => 'uc_file_get_expiration_properties',
        'setter callback' => 'uc_file_set_expiration_properties',
      ],
      'pfid' => [
        'type' => 'integer',
        'label' => t('Product feature ID'),
        'description' => t('The product feature that granted permission to download the file.'),
      ],
      'file-key' => [
        'type' => 'text',
        'label' => t('File key'),
        'description' => t('A hash of the permission and expiraiton data.'),
      ],
      'granted' => [
        'type' => 'date',
        'label' => t('Granted time'),
        'description' => t('The time the permission to download the file was granted.'),
      ],
      'expiration' => [
        'type' => 'date',
        'label' => t('Expiration time'),
        'description' => t('The time when the permission to download the file will expire.'),
      ],
      'accessed' => [
        'type' => 'integer',
        'label' => t('Accesses'),
        'description' => t('The number of times the file has been accessed.'),
      ],
      'addresses' => [
        'type' => 'list<text>',
        'label' => t('IP addresses'),
        'description' => t('List of IP addresses to which the file has been downloaded.'),
      ],
      'download-limit' => [
        'type' => 'integer',
        'label' => t('Download limit'),
        'description' => t('The number of times the user may download the file.'),
      ],
      'address-limit' => [
        'type' => 'integer',
        'label' => t('Address limit'),
        'description' => t('The number of different IP addresses that may download the file.'),
      ],
    ],
    'group' => t('File download'),
    'token type' => 'uc_file',
  ];
  return $data;
}