protected function NodeTitle::getQuery in Freelinking 4.0.x
Same name and namespace in other branches
- 8.3 src/Plugin/freelinking/NodeTitle.php \Drupal\freelinking\Plugin\freelinking\NodeTitle::getQuery()
Get the node query builder.
Parameters
array $target: The target array to construct the query.
Return value
bool|array An array of results or FALSE if an error occurred.
1 call to NodeTitle::getQuery()
- NodeTitle::buildLink in src/
Plugin/ freelinking/ NodeTitle.php - Build a link with the plugin.
File
- src/
Plugin/ freelinking/ NodeTitle.php, line 219
Class
- NodeTitle
- Node Title freelinking plugin.
Namespace
Drupal\freelinking\Plugin\freelinkingCode
protected function getQuery(array $target) {
try {
$query = $this->entityTypeManager
->getStorage('node')
->getQuery('AND');
$node_types = $this
->getAllowedNodeTypes();
if (!empty($node_types)) {
$query
->condition('type', $node_types, 'IN');
}
return $query
->condition('title', $target['dest'])
->condition('status', 1)
->condition('langcode', $target['language']
->getId())
->accessCheck()
->execute();
} catch (InvalidPluginDefinitionException $e) {
return FALSE;
} catch (PluginNotFoundException $e) {
return FALSE;
}
}