function notifications_content_type_enabled in Notifications 6.4
Same name and namespace in other branches
- 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()
- 7 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
$type: Optional content type to return info for, global notifications defaults if none.
$option: Optional option to return for the given content type or the defaults, defaults to returning all settings for the type.
$disabled: Check also for globally disabled subscription types
12 calls to notifications_content_type_enabled()
- notifications_content_comment in notifications_content/
notifications_content.module - Implementation of hook_comment().
- notifications_content_content_extra_fields in notifications_content/
notifications_content.module - Implementation of hook hook_content_extra_fields().
- notifications_content_form_alter in notifications_content/
notifications_content.module - Implementation of hook_form_alter().
- notifications_content_nodeapi in notifications_content/
notifications_content.module - Implementation of hook_nodeapi()
- notifications_content_notifications_object_node in notifications_content/
notifications_content.module - Implementation of hook_notifications_object_node()
File
- notifications_content/
notifications_content.module, line 879 - Subscriptions to content events
Code
function notifications_content_type_enabled($type = NULL, $option = NULL, $disabled = FALSE) {
$settings = variable_get('notifications_content_type', array());
if ($type) {
if (!$disabled && !notifications_subscription_type_enabled($type)) {
$settings = array();
}
elseif (variable_get('notifications_content_per_type', 0)) {
$settings = variable_get('notifications_content_type_' . $type, $settings);
}
}
elseif (!$disabled) {
// Take out globally disabled subscriptions
$settings = array_intersect($settings, notifications_subscription_type_enabled());
}
if ($option) {
return in_array($option, $settings, TRUE);
}
else {
// We filter the array to return an empty one when no option enabled
return array_filter($settings);
}
}