You are here

function notifications_node_autocomplete_title in Notifications 6.4

Same name and namespace in other branches
  1. 6 notifications.node.inc \notifications_node_autocomplete_title()
  2. 6.2 notifications.node.inc \notifications_node_autocomplete_title()
  3. 6.3 notifications.node.inc \notifications_node_autocomplete_title()
  4. 7 includes/node.inc \notifications_node_autocomplete_title()

Menu callback; Retrieve a pipe delimited string of autocomplete suggestions for existing users

1 string reference to 'notifications_node_autocomplete_title'
notifications_menu in ./notifications.module
Implementation of hook_menu().

File

includes/node.inc, line 77
Notifications node API for use by plug-in modules providing node related features

Code

function notifications_node_autocomplete_title($string = '') {
  $matches = array();
  $types = array();
  if (module_exists('notifications_content')) {

    // If notifications content module is enable, take into account the per-content type subscription
    $node_types = node_get_types('names');

    // For each of the content types, check if the "thread" subscription is enabled
    foreach ($node_types as $type => $name) {
      if (notifications_content_type_enabled($type, 'thread')) {
        $types[] = $type;
      }
    }
  }
  foreach (_notifications_node_references($string, 'containts', $types) as $id => $row) {

    // Add a class wrapper for a few required CSS overrides.
    $matches[$row['title'] . " [nid:{$id}]"] = '<div class="reference-autocomplete">' . $row['rendered'] . '</div>';
  }
  drupal_json($matches);
}