You are here

function rules_system_action_info in Rules 7.2

Implements hook_rules_action_info() on behalf of the system module.

Related topics

File

modules/system.rules.inc, line 100
Rules integration for the system module.

Code

function rules_system_action_info() {
  return array(
    'drupal_message' => array(
      'label' => t('Show a message on the site'),
      'group' => t('System'),
      'parameter' => array(
        'message' => array(
          'type' => 'text',
          'label' => t('Message'),
          'sanitize' => TRUE,
          'translatable' => TRUE,
        ),
        'type' => array(
          'type' => 'token',
          'label' => t('Message type'),
          'options list' => 'rules_action_drupal_message_types',
          'default value' => 'status',
          'optional' => TRUE,
        ),
        'repeat' => array(
          'type' => 'boolean',
          'label' => t('Repeat message'),
          'description' => t("If disabled and the message has been already shown, then the message won't be repeated."),
          'default value' => TRUE,
          'optional' => TRUE,
          'restriction' => 'input',
        ),
      ),
      'base' => 'rules_action_drupal_message',
      'access callback' => 'rules_system_integration_access',
    ),
    'drupal_watchdog' => array(
      'label' => t('Logs a message to the system dblog'),
      'group' => t('System'),
      'parameter' => array(
        'type' => array(
          'type' => 'text',
          'label' => t('Type'),
          'description' => t('The category to which this message belongs, displayed in the first column of the dblog.'),
        ),
        'message' => array(
          'type' => 'text',
          'label' => t('Message'),
          'description' => t('The text of the message.'),
          'translatable' => TRUE,
        ),
        'severity' => array(
          'type' => 'token',
          'label' => t('Severity'),
          'options list' => 'watchdog_severity_levels',
          'default value' => WATCHDOG_NOTICE,
          'optional' => TRUE,
        ),
        'link_text' => array(
          'type' => 'text',
          'label' => t('Link text'),
          'description' => t('The text to display for the link (optional)'),
          'optional' => TRUE,
        ),
        'link_path' => array(
          'type' => 'uri',
          'label' => t('Link path'),
          'description' => t('A Drupal path or path alias. Enter (optional) queries after "?" and (optional) anchor after "#".'),
          'optional' => TRUE,
        ),
      ),
      'base' => 'rules_action_drupal_watchdog',
      'access callback' => 'rules_system_integration_access',
    ),
    'redirect' => array(
      'label' => t('Page redirect'),
      'group' => t('System'),
      'parameter' => array(
        'url' => array(
          'type' => 'uri',
          'label' => t('URL'),
          'description' => t('A Drupal path, path alias, or external URL to redirect to. Enter (optional) queries after "?" and (optional) anchor after "#".'),
        ),
        'force' => array(
          'type' => 'boolean',
          'label' => t('Force redirect'),
          'restriction' => 'input',
          'description' => t("Force the redirect even if another destination parameter is present. Per default Drupal would redirect to the path given as destination parameter, in case it is set. Usually the destination parameter is set by appending it to the URL, e.g. !example_url", array(
            '!example_url' => 'http://example.com/user/login?destination=node/2',
          )),
          'optional' => TRUE,
          'default value' => TRUE,
        ),
        'destination' => array(
          'type' => 'boolean',
          'label' => t('Append destination parameter'),
          'restriction' => 'input',
          'description' => t('Whether to append a destination parameter to the URL, so another redirect issued later on would lead back to the origin page.'),
          'optional' => TRUE,
          'default value' => FALSE,
        ),
      ),
      'base' => 'rules_action_drupal_goto',
      'access callback' => 'rules_system_integration_access',
    ),
    'breadcrumb_set' => array(
      'label' => t('Set breadcrumb'),
      'group' => t('System'),
      'parameter' => array(
        'titles' => array(
          'type' => 'list<text>',
          'label' => t('Titles'),
          'description' => t('A list of titles for the breadcrumb links.'),
          'translatable' => TRUE,
        ),
        'paths' => array(
          'type' => 'list<text>',
          'label' => t('Paths'),
          'description' => t('A list of Drupal paths for the breadcrumb links, matching the order of the titles.'),
        ),
      ),
      'base' => 'rules_action_breadcrumb_set',
      'access callback' => 'rules_system_integration_access',
    ),
    'mail' => array(
      'label' => t('Send mail'),
      'group' => t('System'),
      'parameter' => array(
        'to' => array(
          'type' => 'text',
          'label' => t('To'),
          'description' => t('The e-mail address or addresses where the message will be sent to. The formatting of this string must comply with RFC 2822.'),
        ),
        'subject' => array(
          'type' => 'text',
          'label' => t('Subject'),
          'description' => t("The mail's subject."),
          'translatable' => TRUE,
        ),
        'message' => array(
          'type' => 'text',
          'label' => t('Message'),
          'description' => t("The mail's message body."),
          'translatable' => TRUE,
        ),
        'from' => array(
          'type' => 'text',
          'label' => t('From'),
          'description' => t("The mail's from address. Leave it empty to use the site-wide configured address."),
          'optional' => TRUE,
        ),
        'language' => array(
          'type' => 'token',
          'label' => t('Language'),
          'description' => t('If specified, the language used for getting the mail message and subject.'),
          'options list' => 'entity_metadata_language_list',
          'optional' => TRUE,
          'default value' => LANGUAGE_NONE,
          'default mode' => 'selector',
        ),
      ),
      'base' => 'rules_action_mail',
      'access callback' => 'rules_system_integration_access',
    ),
    'mail_to_users_of_role' => array(
      'label' => t('Send mail to all users of a role'),
      'group' => t('System'),
      'parameter' => array(
        'roles' => array(
          'type' => 'list<integer>',
          'label' => t('Roles'),
          'options list' => 'entity_metadata_user_roles',
          'description' => t('Select the roles whose users should receive the mail.'),
        ),
        'subject' => array(
          'type' => 'text',
          'label' => t('Subject'),
          'description' => t("The mail's subject."),
        ),
        'message' => array(
          'type' => 'text',
          'label' => t('Message'),
          'description' => t("The mail's message body."),
        ),
        'from' => array(
          'type' => 'text',
          'label' => t('From'),
          'description' => t("The mail's from address. Leave it empty to use the site-wide configured address."),
          'optional' => TRUE,
        ),
      ),
      'base' => 'rules_action_mail_to_users_of_role',
      'access callback' => 'rules_system_integration_access',
    ),
    'block_ip' => array(
      'label' => t('Block IP address'),
      'group' => t('System'),
      'parameter' => array(
        'ip_address' => array(
          'type' => 'ip_address',
          'label' => t('IP address'),
          'description' => t('If not provided, the IP address of the current user will be used.'),
          'optional' => TRUE,
          'default value' => NULL,
        ),
      ),
      'base' => 'rules_action_block_ip',
      'access callback' => 'rules_system_integration_access',
    ),
  );
}