You are here

function opigno_messaging_preprocess_views_view_field in Opigno messaging 8

Implements hook_preprocess_views_view_field().

Sets class for unread message thread.

File

./opigno_messaging.module, line 621
Contains opigno_messaging.module.

Code

function opigno_messaging_preprocess_views_view_field(&$variables) {
  if ($variables['view']
    ->id() == 'private_message') {
    $ids =& drupal_static(__FUNCTION__);
    $variables['unread_class'] = '';
    if (!isset($ids)) {
      $ids = OpignoMessageThread::getUnreadThreadCount('entity_id');
    }
    if ($ids && in_array($variables['row']->id, $ids)) {

      // Set class for unread message thread.
      $variables['unread_class'] = 'new';
    }
  }
}