You are here

interface RecentlyReadServiceInterface in Recently Read 8

Interface RecentlyReadServiceInterface.

@package Drupal\recently_read

Hierarchy

Expanded class hierarchy of RecentlyReadServiceInterface

All classes that implement RecentlyReadServiceInterface

File

src/RecentlyReadServiceInterface.php, line 13

Namespace

Drupal\recently_read
View source
interface RecentlyReadServiceInterface {

  /**
   * Custom function to insert or update an entry for recently read.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The viewed entity.
   * @param \Drupal\Core\Session\AccountInterface|null $user
   *   The user who read the entity. If NULL then the current user will be used.
   */
  public function insertEntity(EntityInterface $entity, AccountInterface $user = NULL);

  /**
   * Delete records from DB.
   *
   * @param array $records
   *   Number of records to delete.
   */
  public function deleteRecords(array $records);

  /**
   * Get all records in DB for specified user/anonymous.
   *
   * @param int $user_id
   *   User id.
   *
   * @return array|int
   *   Returns an array of record id's.
   */
  public function getRecords($user_id);

  /**
   * Delete all "Recently Read" IDs for the entity.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The entity which might has "Recently Read" records.
   * @param \Drupal\Core\Session\AccountInterface|null $user
   *   The user who read the entity.
   */
  public function deleteEntityRecords(EntityInterface $entity, AccountInterface $user = NULL);

}

Members

Namesort descending Modifiers Type Description Overrides
RecentlyReadServiceInterface::deleteEntityRecords public function Delete all "Recently Read" IDs for the entity. 1
RecentlyReadServiceInterface::deleteRecords public function Delete records from DB. 1
RecentlyReadServiceInterface::getRecords public function Get all records in DB for specified user/anonymous. 1
RecentlyReadServiceInterface::insertEntity public function Custom function to insert or update an entry for recently read. 1