protected function RuleGrantsOperationTrait::ruleGrantsOperation in RNG - Events and Registrations 8.2
Same name and namespace in other branches
- 8 src/RuleGrantsOperationTrait.php \Drupal\rng\RuleGrantsOperationTrait::ruleGrantsOperation()
- 3.x src/RuleGrantsOperationTrait.php \Drupal\rng\RuleGrantsOperationTrait::ruleGrantsOperation()
Checks if any operation actions on a rule grant $operation access.
This does not evaluate conditions.
Parameters
\Drupal\rng\RuleInterface $rule: A rule entity.
string $operation: A registration operation.
Return value
bool Whether $operation is granted by the actions.
2 calls to RuleGrantsOperationTrait::ruleGrantsOperation()
- RegistrationAccessControlHandler::checkAccess in src/
AccessControl/ RegistrationAccessControlHandler.php - UserRNGSelection::buildEntityQuery in src/
Plugin/ EntityReferenceSelection/ UserRNGSelection.php - Builds an EntityQuery to get referenceable entities.
File
- src/
RuleGrantsOperationTrait.php, line 25
Class
- RuleGrantsOperationTrait
- Defines a trait for working with 'registration operation' actions.
Namespace
Drupal\rngCode
protected function ruleGrantsOperation(RuleInterface $rule, $operation) {
$actions = $rule
->getActions();
$operations_actions = array_filter($actions, function ($action) use ($actions, $operation) {
if ($action
->getPluginId() == 'registration_operations') {
$config = $action
->getConfiguration();
return !empty($config['operations'][$operation]);
}
return FALSE;
});
return (bool) count($operations_actions);
}