function themekey_validator_og_group_type in ThemeKey 7.3
Validates a Theme Switching Rule. Allowed Operators: "=", "!" Allowed values:
- og group types as string
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.
1 string reference to 'themekey_validator_og_group_type'
- themekey_og_context_themekey_properties in modules/
themekey.og_context.inc - Implements hook_themekey_properties().
File
- ./
themekey_validators.inc, line 1006 - Provides set of validators which can be used to validate ThemeKey Theme Switching Rules.
Code
function themekey_validator_og_group_type($rule) {
$errors = array();
switch ($rule['operator']) {
case '=':
case '!':
if (function_exists('og_get_all_group_entity')) {
if (!array_key_exists($rule['value'], og_get_all_group_entity())) {
$errors['value'] = t('The group type %value is not defined.', array(
'%value' => $rule['value'],
));
}
}
else {
$errors['property'] = t('Unable to verify property group:type because function og_get_all_group_entity() is missing.');
}
break;
default:
$errors['operator'] = t('Possible operators are "=" and "!"');
break;
}
return $errors;
}