protected function EntityPager::getCurrentRow in Entity Pager 8
Same name and namespace in other branches
- 2.0.x src/EntityPager.php \Drupal\entity_pager\EntityPager::getCurrentRow()
 
Returns the currently active row from the view results.
Return value
bool|int The index of the active row, or FALSE
2 calls to EntityPager::getCurrentRow()
- EntityPager::getCount in src/
EntityPager.php  - Returns a render array for a count of all items.
 - EntityPager::getLink in src/
EntityPager.php  - Returns an Entity pager link.
 
File
- src/
EntityPager.php, line 139  
Class
- EntityPager
 - Entity pager object.
 
Namespace
Drupal\entity_pagerCode
protected function getCurrentRow() {
  $entity = $this
    ->getEntity();
  /** @var \Drupal\views\ResultRow $result */
  foreach ($this
    ->getView()->result as $index => $result) {
    $resultEntity = $this
      ->getResultEntity($result);
    if (!is_null($entity) && $resultEntity
      ->id() === $entity
      ->id()) {
      return $index;
    }
  }
  return FALSE;
}