You are here

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

Callable API function to get the next/prev id of a given entity id.

Parameters

int $entity_id: Entity id.

string $op: The type of operation.

Overrides PrevNextHelperInterface::getPrevnextId

File

src/PrevNextHelper.php, line 62

Class

PrevNextHelper
Defines an PrevNextHelper service.

Namespace

Drupal\prev_next

Code

public function getPrevnextId($entity_id, $op = 'next') {
  switch ($op) {
    case 'prev':
      return $this
        ->getPrevId($entity_id);
    case 'next':
      return $this
        ->getNextId($entity_id);
    default:
      return 0;
  }
}