RngContactRngSelection.php in RNG Contact 8
File
src/Plugin/EntityReferenceSelection/RngContactRngSelection.php
View source
<?php
namespace Drupal\rng_contact\Plugin\EntityReferenceSelection;
use Drupal\rng\Plugin\EntityReferenceSelection\RNGSelectionBase;
class RngContactRngSelection extends RNGSelectionBase {
protected function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS') {
$query = parent::buildEntityQuery($match, $match_operator);
if ($this->currentUser
->isAuthenticated()) {
$query
->condition('owner', $this->currentUser
->id(), '=');
}
else {
$query
->condition($this->entityType
->getKey('id'), NULL, 'IS NULL');
return $query;
}
return $query;
}
}