You are here

function domain_rules_rules_action_info in Domain Rules 7

Implements hook_rules_action_info(). Build select list and settings forms for actions

File

./domain_rules.module, line 344
domain_rules.module @description Port of 'Domain rules' by shushu for Drupal7

Code

function domain_rules_rules_action_info() {
  $actions = array(
    'domain_rules_actions_create_domain' => array(
      'label' => t('Create a domain'),
      'group' => t('Domains'),
      'parameter' => array(
        'sitename' => array(
          'type' => 'text',
          'label' => t('Site name'),
          'description' => t('The new domain site name.'),
          'default value' => '',
        ),
        'subdomain' => array(
          'type' => 'text',
          'label' => t('Domain address'),
          'description' => t('The new domain address.'),
          'default value' => '',
        ),
        'domain_scheme' => array(
          'type' => 'text',
          'label' => t('Schema'),
          'options list' => '__domain_rules_schemes',
          'default value' => 0,
        ),
        'valid' => array(
          'type' => 'text',
          'label' => t('Domain status'),
          'description' => t('The new domain site name.'),
          'options list' => '__domain_rules_state',
          'default value' => 1,
        ),
      ),
    ),
    'domain_rules_actions_change_subdomain' => array(
      'label' => t('Change a subdomain'),
      'group' => t('Domains'),
      'parameter' => array(
        'subdomain' => array(
          'type' => 'text',
          'label' => t('Current Domain address'),
          'description' => t('The current domain address.'),
          'default value' => '',
        ),
        'new_subdomain' => array(
          'type' => 'text',
          'label' => t('New Domain address.'),
          'description' => t('The new domain address.'),
          'default value' => '',
        ),
      ),
    ),
    'domain_rules_actions_delete_domain' => array(
      'label' => t('Delete a domain'),
      'group' => t('Domains'),
      'parameter' => array(
        'subdomain' => array(
          'type' => 'text',
          'label' => t('Domain address'),
          'description' => t('The domain address to delete.'),
          'default value' => '',
        ),
      ),
    ),
    'domain_rules_action_set_user_defaults_domain' => array(
      'label' => t('Set user defaults for a domain'),
      'group' => t('Domains'),
      'parameter' => array(
        'subdomain' => array(
          'type' => 'text',
          'label' => t('Domain address'),
          'description' => t('Domain address.'),
          'default value' => '',
        ),
        'state' => array(
          'type' => 'text',
          'label' => t('State'),
          'options list' => '__domain_rules_state',
          'default value' => 0,
        ),
        'role_id' => array(
          'type' => 'text',
          'label' => t('Role ID'),
          'options list' => '__domain_rules_user_roles',
          'default value' => '',
        ),
      ),
    ),
    'domain_rules_action_set_node_domain' => array(
      'label' => t('Set domain to a node'),
      'group' => t('Domains'),
      'parameter' => array(
        'subdomain' => array(
          'node' => array(),
          'type' => 'text',
          'label' => t('Domain address'),
          'description' => t('Domain address.'),
          'default value' => '',
        ),
        'node' => array(
          'type' => 'node',
          'label' => t('Content'),
          'save' => TRUE,
        ),
      ),
    ),
    'domain_rules_action_remove_node_domain' => array(
      'label' => t('Remove domain from a node'),
      'group' => t('Domains'),
      'parameter' => array(
        'subdomain' => array(
          'node' => array(),
          'type' => 'text',
          'label' => t('Domain address'),
          'description' => t('Domain address.'),
          'default value' => '',
        ),
        'node' => array(
          'type' => 'node',
          'label' => t('Content'),
          'save' => TRUE,
        ),
      ),
    ),
    'domain_rules_action_set_domain_theme' => array(
      'label' => t('Set domain theme'),
      'group' => t('Domains'),
      'parameter' => array(
        'subdomain' => array(
          'node' => array(),
          'type' => 'text',
          'label' => t('Domain address'),
          'description' => t('Domain address.'),
          'default value' => '',
        ),
        'theme' => array(
          'type' => 'text',
          'label' => t('Theme name'),
          'description' => t('The Theme name'),
          'options list' => '__domain_rules_themes',
          'default value' => '',
        ),
      ),
    ),
    'domain_rules_action_remove_user_domain' => array(
      'label' => t('Remove domain from a user'),
      'group' => t('Domains'),
      'parameter' => array(
        'subdomain' => array(
          'node' => array(),
          'type' => 'text',
          'label' => t('Domain address'),
          'description' => t('Domain address.'),
          'default value' => '',
        ),
        'user' => array(
          'type' => 'user',
          'label' => t('User'),
          'save' => TRUE,
        ),
      ),
    ),
    'domain_rules_action_set_user_domain' => array(
      'label' => t('Set domain to a user'),
      'group' => t('Domains'),
      'parameter' => array(
        'subdomain' => array(
          'node' => array(),
          'type' => 'text',
          'label' => t('Domain address'),
          'description' => t('Domain address.'),
          'default value' => '',
        ),
        'user' => array(
          'type' => 'user',
          'label' => t('User'),
          'save' => TRUE,
        ),
      ),
    ),
    'domain_rules_action_add_domain_alias' => array(
      'label' => t('Add alias to a domain'),
      'group' => t('Domains'),
      'parameter' => array(
        'subdomain' => array(
          'type' => 'text',
          'label' => t('Domain address'),
          'description' => t('Domain address.'),
          'default value' => '',
        ),
        'pattern' => array(
          'type' => 'text',
          'label' => t('Pattern'),
          'default value' => '',
        ),
        'redirect' => array(
          'type' => 'boolean',
          'label' => t('Redirect'),
          'description' => t('Check the redirect box if you would like requests made to the alias to redirect to the registered domain'),
          'default value' => false,
        ),
      ),
    ),
    'domain_rules_action_variable_set' => array(
      'label' => t('Set a domain variable'),
      'group' => t('Domains'),
      'parameter' => array(
        'subdomain' => array(
          'type' => 'text',
          'label' => t('Domain address'),
          'description' => t('Domain address.'),
          'default value' => '',
        ),
        'variable' => array(
          'type' => 'text',
          'label' => t('Variable'),
          'description' => t('Any variable set by domain_batch_actions(). Known variables: site_name, site_mail, site_slogan, site_frontpage, anonymous'),
          'default value' => '',
        ),
        'value' => array(
          'type' => 'text',
          'label' => t('Valule'),
          'default value' => '',
        ),
      ),
    ),
  );
  if (module_exists('domain_entity')) {
    $actions['domain_rules_action_set_entity_domain'] = array(
      'label' => t('Set domain to an entity'),
      'group' => t('Domains'),
      'parameter' => array(
        'subdomain' => array(
          'node' => array(),
          'type' => 'text',
          'label' => t('Domain address'),
          'description' => t('Domain address.'),
          'default value' => '',
        ),
        'entity' => array(
          'type' => 'entity',
          'label' => t('Entity'),
          'save' => TRUE,
        ),
      ),
    );
  }
  return $actions;
}