You are here

protected function NodeTitle::getQuery in Freelinking 8.3

Same name and namespace in other branches
  1. 4.0.x 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\freelinking

Code

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;
  }
}