public function CommerceFileLicenseEntityRulesController::eventInfo in Commerce File 7
Overrides EntityDefaultRulesController::eventInfo
File
- ./
commerce_file.rules.inc, line 23 - Provides Rules integration for entities provided via the CRUD API.
Class
- CommerceFileLicenseEntityRulesController
- Default controller for generating Rules integration.
Code
public function eventInfo() {
$info = $this->info;
$type = $this->type;
$label = $info['label'];
$tokens = array(
'@entity' => drupal_strtolower($label),
);
$defaults = array(
'module' => isset($info['module']) ? $info['module'] : 'entity',
'group' => $label,
'access callback' => 'entity_rules_integration_event_access',
);
// intialize with standard events
$items = parent::eventInfo();
// Update event - add an unchanged variable
$items[$type . '_update']['variables']["{$type}_unchanged"] = array(
'type' => $type,
'label' => t('Unchanged @entity', $tokens),
'skip save' => TRUE,
'handler' => 'rules_events_entity_unchanged',
);
// File download event
$items[$type . '_download'] = $defaults + array(
'label' => t('Requesting a download for a licensed file', $tokens),
'variables' => array(
$type => array(
'type' => $type,
'label' => t('active @entity', $tokens),
),
),
);
// Access denied event
$items[$type . '_access_denied'] = $defaults + array(
'label' => t('Before denying access to a licensed file', $tokens),
'variables' => array(
$type => array(
'type' => $type,
'label' => t('active @entity', $tokens),
),
),
);
// Log file download event
$items[$type . '_log_download'] = $defaults + array(
'label' => t('Logging access to a licensed file', $tokens),
'variables' => array(
$type => array(
'type' => $type,
'label' => t('active @entity', $tokens),
),
),
);
return $items;
}