function themekey_validator_no_whitespace in ThemeKey 7.3
Same name and namespace in other branches
- 6.4 themekey_validators.inc \themekey_validator_no_whitespace()
- 6.2 themekey_validators.inc \themekey_validator_no_whitespace()
- 6.3 themekey_validators.inc \themekey_validator_no_whitespace()
- 7 themekey_validators.inc \themekey_validator_no_whitespace()
- 7.2 themekey_validators.inc \themekey_validator_no_whitespace()
Validates a Theme Switching Rule. Allowed Operators: all Allowed values: any string without whitespace
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.
2 calls to themekey_validator_no_whitespace()
- themekey_validator_drupal_path in ./
themekey_validators.inc - Validates a Theme Switching Rule. Allowed Operators: "=", "!" Allowed values: paths without whitespace
- themekey_validator_wildcard in ./
themekey_validators.inc - Validates a Theme Switching Rule. Allowed Operators: any Allowed wildcards: any string without whitespace and not starting with "#" or "%"
File
- ./
themekey_validators.inc, line 503 - Provides set of validators which can be used to validate ThemeKey Theme Switching Rules.
Code
function themekey_validator_no_whitespace($rule) {
$errors = array();
if (preg_match("/\\s/", $rule['value'])) {
$errors['value'] = t('Value must not contain whitespace characters');
}
return $errors;
}