function notifications_content_type_enabled in Notifications 7
Same name and namespace in other branches
- 6.4 notifications_content/notifications_content.module \notifications_content_type_enabled()
- 6 notifications_content/notifications_content.module \notifications_content_type_enabled()
- 6.2 notifications_content/notifications_content.module \notifications_content_type_enabled()
- 6.3 notifications_content/notifications_content.module \notifications_content_type_enabled()
Get subscription options for this content type
PHP Note: We need to use strict checking for in_array(), http://es.php.net/manual/en/function.in-array.php#91911
Parameters
$node_type: Optional content type to return info for, global notifications defaults if none.
$subscription_type: Optional subscription type to check for (if none, it will return true if any enabled)
6 calls to notifications_content_type_enabled()
- notifications_content_content_extra_fields in notifications_content/
notifications_content.module - Implementation of hook hook_content_extra_fields().
- notifications_content_node_event_enabled in notifications_content/
notifications_content.module - Check whether a specific event type is enabled for this node type
- notifications_content_notifications_object_node in notifications_content/
notifications_content.module - Implementation of hook_notifications_object_node()
- notifications_content_types in notifications_content/
notifications_content.module - Get content types available for subscriptions to content type
- notifications_tags_notifications_object_node in notifications_tags/
notifications_tags.module - Implementation of hook_notifications_object_node()
File
- notifications_content/
notifications_content.module, line 782 - Subscriptions to content events
Code
function notifications_content_type_enabled($node_type, $subscription_type = NULL) {
// If the subscription type not globally enabled, always return false
if ($subscription_type && !notifications_subscription_type_enabled($subscription_type)) {
return FALSE;
}
// So there's no type or it is enabled. Check per content type
if (variable_get('notifications_content_per_type', 0)) {
// In this case, settings will be an array of enabled subscription types per content type
$settings = variable_get('notifications_content_type_' . $node_type, array());
return $subscription_type ? in_array($subscription_type, $settings) : (bool) array_filter($settings);
}
else {
// In this case, settings is a list of content types for which global subscriptions are enabled
$settings = variable_get('notifications_content_type', array());
return in_array($node_type, $settings, TRUE);
}
}