You are here

function rules_rules_core_data_info in Rules 7.2

Implements hook_rules_data_info() on behalf of the pseudo rules_core module.

See also

rules_core_modules()

Related topics

File

modules/rules_core.rules.inc, line 41
Rules integration with Drupal core.

Code

function rules_rules_core_data_info() {
  $return = array(
    'text' => array(
      'label' => t('text'),
      'ui class' => 'RulesDataUIText',
      'token type' => 'rules_text',
    ),
    'token' => array(
      'label' => t('text token'),
      'parent' => 'text',
      'ui class' => 'RulesDataUITextToken',
      'token type' => 'rules_token',
    ),
    // A formatted text as used by entity metadata.
    'text_formatted' => array(
      'label' => t('formatted text'),
      'ui class' => 'RulesDataUITextFormatted',
      'wrap' => TRUE,
      'property info' => entity_property_text_formatted_info(),
    ),
    'decimal' => array(
      'label' => t('decimal number'),
      'parent' => 'text',
      'ui class' => 'RulesDataUIDecimal',
      'token type' => 'rules_decimal',
    ),
    'integer' => array(
      'label' => t('integer'),
      'class' => 'RulesIntegerWrapper',
      'parent' => 'decimal',
      'ui class' => 'RulesDataUIInteger',
      'token type' => 'rules_integer',
    ),
    'date' => array(
      'label' => t('date'),
      'ui class' => 'RulesDataUIDate',
      'token type' => 'rules_date',
    ),
    'duration' => array(
      'label' => t('duration'),
      'parent' => 'integer',
      'ui class' => 'RulesDataUIDuration',
      'token type' => 'rules_duration',
    ),
    'boolean' => array(
      'label' => t('truth value'),
      'ui class' => 'RulesDataUIBoolean',
      'token type' => 'rules_boolean',
    ),
    'uri' => array(
      'label' => t('URI'),
      'parent' => 'text',
      // Clean inserted tokens with "rawurlencode".
      'cleaning callback' => 'rawurlencode',
      'ui class' => 'RulesDataUIURI',
      'token type' => 'rules_uri',
    ),
    'list' => array(
      'label' => t('list', array(), array(
        'context' => 'data_types',
      )),
      'wrap' => TRUE,
      'group' => t('List', array(), array(
        'context' => 'data_types',
      )),
    ),
    'list<text>' => array(
      'label' => t('list of text'),
      'ui class' => 'RulesDataUIListText',
      'wrap' => TRUE,
      'group' => t('List', array(), array(
        'context' => 'data_types',
      )),
    ),
    'list<integer>' => array(
      'label' => t('list of integer'),
      'ui class' => 'RulesDataUIListInteger',
      'wrap' => TRUE,
      'group' => t('List', array(), array(
        'context' => 'data_types',
      )),
    ),
    'list<token>' => array(
      'label' => t('list of text tokens'),
      'ui class' => 'RulesDataUIListToken',
      'wrap' => TRUE,
      'group' => t('List', array(), array(
        'context' => 'data_types',
      )),
    ),
    'entity' => array(
      'label' => t('any entity'),
      'group' => t('Entity'),
      'is wrapped' => TRUE,
    ),
    'ip_address' => array(
      'label' => t('IP Address'),
      'parent' => 'text',
      'ui class' => 'RulesDataUIIPAddress',
      'token type' => 'rules_text',
    ),
  );
  foreach (entity_get_info() as $type => $info) {
    if (!empty($info['label'])) {
      $return[$type] = array(
        'label' => strtolower($info['label'][0]) . substr($info['label'], 1),
        'parent' => 'entity',
        'wrap' => TRUE,
        'group' => t('Entity'),
        'ui class' => empty($info['exportable']) ? 'RulesDataUIEntity' : 'RulesDataUIEntityExportable',
      );

      // If this entity type serves as bundle for another one, provide an
      // options list for selecting a bundle entity.
      if (!empty($info['bundle of'])) {
        $return[$type]['ui class'] = 'RulesDataUIBundleEntity';
      }
    }
  }
  if (module_exists('taxonomy')) {

    // For exportability identify vocabularies by name.
    $return['taxonomy_vocabulary']['wrapper class'] = 'RulesTaxonomyVocabularyWrapper';
    $return['taxonomy_vocabulary']['ui class'] = 'RulesDataUITaxonomyVocabulary';
  }
  return $return;
}