You are here

public function PrevNextHelper::getPrevId in Previous/Next API 8.2

Callable API function to retun the prev id of a given entity id.

Parameters

int $entity_id: Entity id.

Return value

int|null Entity id if found.

Overrides PrevNextHelperInterface::getPrevId

1 call to PrevNextHelper::getPrevId()
PrevNextHelper::getPrevnextId in src/PrevNextHelper.php
Callable API function to get the next/prev id of a given entity id.

File

src/PrevNextHelper.php, line 79

Class

PrevNextHelper
Defines an PrevNextHelper service.

Namespace

Drupal\prev_next

Code

public function getPrevId($entity_id) {
  return $this->database
    ->query("SELECT prev_nid FROM {prev_next_node} WHERE nid = :nid", array(
    ':nid' => $entity_id,
  ))
    ->fetchField();
}