public function SimpleSitemapViews::getIndexIdByPosition in Simple XML sitemap 8.3
Same name and namespace in other branches
- 4.x modules/simple_sitemap_views/src/SimpleSitemapViews.php \Drupal\simple_sitemap_views\SimpleSitemapViews::getIndexIdByPosition()
Returns the ID of the record in the index for the specified position.
Parameters
int $position: Position of the record.
\Drupal\Core\Database\Query\ConditionInterface|null $condition: The query conditions.
Return value
int|bool The ID of the record, or FALSE if there is no specified position.
File
- modules/
simple_sitemap_views/ src/ SimpleSitemapViews.php, line 411
Class
- SimpleSitemapViews
- Class to manage sitemap data for views.
Namespace
Drupal\simple_sitemap_viewsCode
public function getIndexIdByPosition($position, ConditionInterface $condition = NULL) {
$query = $this->database
->select('simple_sitemap_views', 'ssv');
$query
->addField('ssv', 'id');
if (!empty($condition)) {
$query
->condition($condition);
}
$query
->orderBy('id', 'ASC');
$query
->range($position - 1, 1);
return $query
->execute()
->fetchField();
}