You are here

function entity_rules_entity_rules_event_info in Entity Rules 7

Implements hook_entity_rules_event_info().

Define basic CRUD rules

File

./entity_rules.module, line 382
Module file for the Entity Rules.

Code

function entity_rules_entity_rules_event_info() {
  $crud_rule_vars[] = array(
    'type' => 'boolean',
    'label' => 'Continue Rules',
    'name' => 'continue',
    'usage' => '11',
    // Parameter var. Why is this not defined as constant in Rules
    'weight' => 1,
    'description' => t('If set to FALSE no rules after the current will be invoked.'),
    'entity_rules_settings' => array(
      'default_value' => TRUE,
    ),
  );
  $defaults = array(
    'needs_form' => FALSE,
    'component_types' => array(
      'rule',
      'rule set',
    ),
  );
  return array(
    'create' => array(
      'label' => t('Create'),
      'vars' => $crud_rule_vars,
    ) + $defaults,
    'update' => array(
      'label' => t('Update'),
      'vars' => $crud_rule_vars,
    ) + $defaults,
    'delete' => array(
      'label' => t('Delete'),
      'vars' => $crud_rule_vars,
    ) + $defaults,
    'validation' => array(
      'label' => t('Validation'),
      'needs_form' => TRUE,
      'component_types' => array(
        'rule',
        'rule set',
        'and',
        'or',
      ),
      'vars' => array(
        array(
          'type' => 'boolean',
          'label' => 'Entity Validates',
          'name' => 'entity_is_validate',
          'usage' => '11',
          // Parameter var. Why is this not defined as constant in Rules
          'weight' => 1,
          'description' => t('If set to FALSE the entity fails validation.'),
          'entity_rules_settings' => array(
            'default_value' => TRUE,
          ),
        ),
      ),
    ) + $defaults,
    'form_access' => array(
      'label' => t('Form Access'),
      'needs_form' => TRUE,
      'component_types' => array(
        'rule',
        'rule set',
        'and',
        'or',
      ),
      'vars' => array(
        array(
          'type' => 'boolean',
          'label' => 'Entity Form Access',
          'name' => 'entity_form_acccess',
          'usage' => '11',
          // Parameter var. Why is this not defined as constant in Rules
          'weight' => 1,
          'description' => t('If set to FALSE then form will not be shown to the user.'),
          'entity_rules_settings' => array(
            'default_value' => TRUE,
          ),
        ),
      ),
    ) + $defaults,
  );
}