private function SelectTranslation::nodeAccessJoin in Select translation 8
Join to the node table where the nodes have the given language.
Parameters
string $language: The language of the nodes that should be retrieved.
string $alias: The alias of the main node table.
string $sub_query_alias: The alias of the sub query node table.
1 call to SelectTranslation::nodeAccessJoin()
- SelectTranslation::query in src/
Plugin/ views/ filter/ SelectTranslation.php - Executes the query.
File
- src/
Plugin/ views/ filter/ SelectTranslation.php, line 236
Class
- SelectTranslation
- Views select translation filter handler.
Namespace
Drupal\select_translation\Plugin\views\filterCode
private function nodeAccessJoin($language, $alias, $sub_query_alias) {
$sub_query = \Drupal::database()
->select('node_field_data', $sub_query_alias);
$sub_query
->addField($sub_query_alias, 'nid');
$sub_query
->addfield($sub_query_alias, 'status');
$sub_query
->addField($sub_query_alias, 'langcode');
$sub_query
->condition("{$sub_query_alias}.langcode", $language);
$configuration = [
'table' => $sub_query,
'field' => 'nid',
'left_table' => $alias,
'left_field' => 'nid',
'operator' => '=',
];
return Views::pluginManager('join')
->createInstance('standard', $configuration);
}