function Notifications_Subscription::get_conditions in Notifications 7
Same name and namespace in other branches
- 6.4 includes/notifications_subscription.class.inc \Notifications_Subscription::get_conditions()
Get fields as array of field => value pairs
Duplicate fields are returned as field => array(value1, value2...)
Parameters
$type: Optional to just return the values for some field type
2 calls to Notifications_Subscription::get_conditions()
- Notifications_Subscription::has_condition in ./
notifications.subscription.inc - Check whether we have a given condition
- Notifications_Subscription::serialize_fields in ./
notifications.subscription.inc - Order and serialize fields so we can get a unique signature for this subscription fields
File
- ./
notifications.subscription.inc, line 1167 - Drupal Notifications Framework - Default class file
Class
- Notifications_Subscription
- Common base for subscription type and subscription instance
Code
function get_conditions($type = NULL) {
$list = array();
foreach ($this
->get_fields() as $field) {
// We cannot simply use isset() because the value may be NULL
if (!array_key_exists($field->field, $list)) {
$list[$field->field] = $field->value;
}
elseif (is_array($list[$field->field])) {
$list[$field->field][] = $field->value;
}
else {
$list[$field->field] = array(
$list[$field->field],
$field->value,
);
}
}
if (isset($type)) {
return isset($list[$type]) ? $list[$type] : NULL;
}
else {
return $list;
}
}