function themekey_validator_ctype_digit in ThemeKey 7.3
Same name and namespace in other branches
- 6.4 themekey_validators.inc \themekey_validator_ctype_digit()
- 6.2 themekey_validators.inc \themekey_validator_ctype_digit()
- 6.3 themekey_validators.inc \themekey_validator_ctype_digit()
- 7 themekey_validators.inc \themekey_validator_ctype_digit()
- 7.2 themekey_validators.inc \themekey_validator_ctype_digit()
Validates a Theme Switching Rule. Allowed Operators: "=", "!", "<", "<=", ">", ">=" Allowed values: string of digits (numbers)
Parameters
$rule: A Theme Switching Rule as associative array:
- property: ThemeKey property as string (e.g., "drupal:path")
- wildcard: optional string, only used if property is "drupal:path:wildcard"
- operator: ThemeKey operator as string ("=", "!", "*", "!*", "<", "<=", ">", ">=", "~", "!~")
- value: ThemeKey property value as string
Return value
An associative array of errors:
- property: translated error message as string describing a problem with the property
- wildcard: translated error message as string describing a problem with the wildcard
- operator: translated error message as string describing a problem with the operator
- value: translated error message as string describing a problem with the value
If no errors detected the array is empty.
14 string references to 'themekey_validator_ctype_digit'
- hook_themekey_properties in docs/
themekey.api.php - By Implementing hook_themekey_properties() it's possible to add new properties to ThemeKey.
- themekey_blog_themekey_properties in modules/
themekey.blog.inc - Implements hook_themekey_properties().
- themekey_book_themekey_properties in modules/
themekey.book.inc - Implements hook_themekey_properties().
- themekey_browscap_themekey_properties in modules/
themekey.browscap.inc - Implements hook_themekey_properties().
- themekey_comment_themekey_properties in modules/
themekey.comment.inc - Implements hook_themekey_properties().
File
- ./
themekey_validators.inc, line 129 - Provides set of validators which can be used to validate ThemeKey Theme Switching Rules.
Code
function themekey_validator_ctype_digit($rule) {
$errors = array();
switch ($rule['operator']) {
case '~':
case '!~':
$errors['operator'] = t('Possible operators are "=", "!", "*", "!*", <", "<=", ">" and ">="');
break;
}
if (!ctype_digit($rule['value'])) {
$errors['value'] = t('Value must be a number');
}
return $errors;
}