You are here

function notifications_content_types in Notifications 5

Same name and namespace in other branches
  1. 6.4 notifications_content/notifications_content.module \notifications_content_types()
  2. 6 notifications_content/notifications_content.module \notifications_content_types()
  3. 6.2 notifications_content/notifications_content.module \notifications_content_types()
  4. 6.3 notifications_content/notifications_content.module \notifications_content_types()
  5. 7 notifications_content/notifications_content.module \notifications_content_types()

Get content types available for subscriptions

Parameters

$field: Optional field to return as array value. If none it will return the full objects.

5 calls to notifications_content_types()
notifications_content_notifications in notifications_content/notifications_content.module
Implementation of hook_notifications()
notifications_content_page_nodetype in notifications_content/notifications_content.module
User subscriptions to content types
notifications_content_page_thread in notifications_content/notifications_content.module
Subscriptions page callback: List thread subscriptions
notifications_content_settings_form in notifications_content/notifications_content.module
Admin settings form
notifications_feed_user_page in notifications_feed/notifications_feed.module
Menu callback. User subscriptions to groups.
2 string references to 'notifications_content_types'
Notifications_Content_Tests::testNotificationsContent in tests/notifications_content.test
Play with creating, retrieving, deleting a pair subscriptions
notifications_update_5 in ./notifications.install
Update content type and taxonomy options

File

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

Code

function notifications_content_types($field = NULL) {

  // Get list of available node types, all of them will be allowed by default
  $types = array();
  if ($allowed = variable_get('notifications_content_types', array())) {
    $allowed = array_filter($allowed);
    foreach (node_get_types() as $type => $info) {
      if (!empty($allowed[$type])) {
        $types[$type] = $info;
      }
    }
  }
  else {
    $types = node_get_types();
  }
  if ($field) {
    foreach (array_keys($types) as $type) {
      $types[$type] = $types[$type]->{$field};
    }
  }
  return $types;
}