You are here

public function PrivateMessageThread::getLastDeleteTimestamp in Private Message 8

Same name and namespace in other branches
  1. 8.2 src/Entity/PrivateMessageThread.php \Drupal\private_message\Entity\PrivateMessageThread::getLastDeleteTimestamp()

Get the last delete timestamp for the given user.

Parameters

\Drupal\Core\Session\AccountInterface $account: The user whose last delete time should be retrieved.

Return value

int A UNIX timestamp indicating the last time the user marked the thread as deleted.

Overrides PrivateMessageThreadInterface::getLastDeleteTimestamp

1 call to PrivateMessageThread::getLastDeleteTimestamp()
PrivateMessageThread::filterUserDeletedMessages in src/Entity/PrivateMessageThread.php
Filter messages in the thread deleted by the given account.

File

src/Entity/PrivateMessageThread.php, line 218

Class

PrivateMessageThread
Defines the Private Message Thread entity.

Namespace

Drupal\private_message\Entity

Code

public function getLastDeleteTimestamp(AccountInterface $account) {
  $private_message_delete_time = FALSE;
  foreach ($this
    ->get('last_delete_time') as $last_delete_time) {
    if ($last_delete_time->entity
      ->getOwnerId() == $account
      ->id()) {
      $private_message_delete_time = $last_delete_time->entity
        ->get('delete_time')->value;
      break;
    }
  }
  return $private_message_delete_time;
}