class ConditionTestDualUser in Drupal 10
Same name and namespace in other branches
- 8 core/modules/system/tests/modules/condition_test/src/Plugin/Condition/ConditionTestDualUser.php \Drupal\condition_test\Plugin\Condition\ConditionTestDualUser
- 9 core/modules/system/tests/modules/condition_test/src/Plugin/Condition/ConditionTestDualUser.php \Drupal\condition_test\Plugin\Condition\ConditionTestDualUser
Provides a condition that requires two users.
Plugin annotation
@Condition(
id = "condition_test_dual_user",
label = @Translation("Dual user"),
context_definitions = {
"user1" = @ContextDefinition("entity:user", label = @Translation("User 1")),
"user2" = @ContextDefinition("entity:user", label = @Translation("User 2"))
}
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
- class \Drupal\Core\Executable\ExecutablePluginBase implements CacheableDependencyInterface, ExecutableInterface, ContextAwarePluginInterface uses ContextAwarePluginTrait
- class \Drupal\Core\Condition\ConditionPluginBase implements ConditionInterface uses ContextAwarePluginAssignmentTrait
- class \Drupal\condition_test\Plugin\Condition\ConditionTestDualUser
- class \Drupal\Core\Condition\ConditionPluginBase implements ConditionInterface uses ContextAwarePluginAssignmentTrait
- class \Drupal\Core\Executable\ExecutablePluginBase implements CacheableDependencyInterface, ExecutableInterface, ContextAwarePluginInterface uses ContextAwarePluginTrait
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
Expanded class hierarchy of ConditionTestDualUser
File
- core/
modules/ system/ tests/ modules/ condition_test/ src/ Plugin/ Condition/ ConditionTestDualUser.php, line 19
Namespace
Drupal\condition_test\Plugin\ConditionView source
class ConditionTestDualUser extends ConditionPluginBase {
/**
* {@inheritdoc}
*/
public function evaluate() {
$user1 = $this
->getContextValue('user1');
$user2 = $this
->getContextValue('user2');
return $user1
->id() === $user2
->id();
}
/**
* {@inheritdoc}
*/
public function summary() {
return $this
->t('This condition has two users.');
}
}