You are here

function notifications_content_type_enabled in Notifications 6.2

Same name and namespace in other branches
  1. 6.4 notifications_content/notifications_content.module \notifications_content_type_enabled()
  2. 6 notifications_content/notifications_content.module \notifications_content_type_enabled()
  3. 6.3 notifications_content/notifications_content.module \notifications_content_type_enabled()
  4. 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.

7 calls to notifications_content_type_enabled()
notifications_content_comment in notifications_content/notifications_content.module
Implementation of hook_comment().
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 in notifications_content/notifications_content.module
Implementation of hook_notifications()
notifications_content_types in notifications_content/notifications_content.module
Get content types available for subscriptions to content type

... See full list

File

notifications_content/notifications_content.module, line 833
Subscriptions to content events

Code

function notifications_content_type_enabled($type = NULL, $option = NULL) {
  $defaults = variable_get('notifications_content_type', array());
  if ($type && variable_get('notifications_content_per_type', 0)) {
    $settings = variable_get('notifications_content_type_' . $type, $defaults);
  }
  else {
    $settings = $defaults;
  }
  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);
  }
}