You are here

function message_views_handlers in Message 6

Implementation of hook_views_handlers().

File

includes/message.views.inc, line 12
Provides support for the Views module.

Code

function message_views_handlers() {
  $data = array();

  // Add message's core handlers.
  $handlers = array(
    'message_handler_field_message_render' => 'views_handler_field',
    'message_handler_field_realm' => 'views_handler_field',
    'message_handler_filter_realm' => 'views_handler_filter_in_operator',
    'message_handler_argument_realm' => 'views_handler_argument',
    'message_handler_filter_realm_user_access' => 'views_handler_filter_in_operator',
  );
  foreach ($handlers as $handler => $parent) {
    $data['handlers'][$handler] = array(
      'parent' => $parent,
      'path' => drupal_get_path('module', 'message') . '/includes',
    );
  }

  // Allow plugins to declare their handlers. Handlers must define their path.
  foreach (message_get_plugin_messages() as $plugin_name => $plugin) {
    $plugin_handlers = array();
    if (!empty($plugin['views']['handlers callback'])) {
      $plugin_handlers = call_user_func($plugin['views']['handlers callback']);
    }
    $data['handlers'] = array_merge($data['handlers'], $plugin_handlers);
  }
  return $data;
}