public function PrevNextApi::bundlesSql in Previous/Next API 8.2
Helper function to return a SQL clause for bundles to be indexed.
Parameters
string $bundle_name: The indexing criteria for the type of entity to query for.
object $bundle: Prev/Next bundle configuration.
Return value
string Returns the sql string.
Overrides PrevNextApiInterface::bundlesSql
1 call to PrevNextApi::bundlesSql()
- PrevNextApi::add in src/
PrevNextApi.php - Create the prev_next records.
File
- src/
PrevNextApi.php, line 174
Class
- PrevNextApi
- Defines an PrevNextApi service.
Namespace
Drupal\prev_nextCode
public function bundlesSql($bundle_name, $bundle) {
$same_type = $bundle
->get('same_type');
if (!$same_type) {
$types = $this->prevnextHelper
->getBundleNames();
$quoted_types = [];
foreach ($this->prevnextHelper
->getBundleNames() as $type) {
$quoted_types[] = "'" . $type . "'";
}
$cond = '';
if (count($types)) {
$cond = 'AND type IN (' . implode(',', $quoted_types) . ')';
}
}
else {
$cond = "AND type = '" . $bundle_name . "'";
}
return $cond;
}