You are here

function opigno_messaging_views_data_alter in Opigno messaging 3.x

Implements hook_views_data_alter().

File

./opigno_messaging.module, line 496
Contains opigno_messaging.module.

Code

function opigno_messaging_views_data_alter(array &$data) {

  // The filter by the private messages thread name.
  $data['private_message_threads']['opigno_pm_thread_name'] = [
    'filter' => [
      'title' => t('Opigno private message user/group name'),
      'help' => t('Provides a custom filter for the private message threads user/group name.'),
      'real field' => 'id',
      'id' => 'opigno_pm_thread_name',
    ],
  ];

  // The filter by the current user discussions.
  $data['private_message_threads']['opigno_pm_thread_ids'] = [
    'filter' => [
      'title' => t('Opigno available private message threads'),
      'help' => t('Provides a custom filter to limit the query to the available user message threads.'),
      'real field' => 'id',
      'id' => 'opigno_available_thread_ids',
    ],
  ];

  // Custom sort plugin to display the current thread at the top.
  $data['private_message_threads']['current_thread_first'] = [
    'title' => t('Opigno display the current thread at the top'),
    'group' => t('Opigno messaging'),
    'help' => t('Display the current thread at the top, then others.'),
    'sort' => [
      'field' => 'updated',
      'id' => 'current_thread_first',
    ],
  ];
}