class RngContactRngSelection in RNG Contact 8
Provides selection for contact entities when registering.
Plugin annotation
@EntityReferenceSelection(
id = "rng:register:rng_contact",
label = @Translation("Contact selection"),
entity_types = {"rng_contact"},
group = "rng_register",
provider = "rng",
weight = 10
)
Hierarchy
- class \Drupal\rng_contact\Plugin\EntityReferenceSelection\RngContactRngSelection extends \Drupal\rng\Plugin\EntityReferenceSelection\RNGSelectionBase
Expanded class hierarchy of RngContactRngSelection
File
- src/
Plugin/ EntityReferenceSelection/ RngContactRngSelection.php, line 19
Namespace
Drupal\rng_contact\Plugin\EntityReferenceSelectionView source
class RngContactRngSelection extends RNGSelectionBase {
/**
* {@inheritdoc}
*/
protected function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS') {
$query = parent::buildEntityQuery($match, $match_operator);
// Select contacts owned by the user.
if ($this->currentUser
->isAuthenticated()) {
$query
->condition('owner', $this->currentUser
->id(), '=');
}
else {
// Cancel the query.
$query
->condition($this->entityType
->getKey('id'), NULL, 'IS NULL');
return $query;
}
return $query;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RngContactRngSelection:: |
protected | function |