class ConditionTestDualUser
Same name in other branches
- 8.9.x core/modules/system/tests/modules/condition_test/src/Plugin/Condition/ConditionTestDualUser.php \Drupal\condition_test\Plugin\Condition\ConditionTestDualUser
- 10 core/modules/system/tests/modules/condition_test/src/Plugin/Condition/ConditionTestDualUser.php \Drupal\condition_test\Plugin\Condition\ConditionTestDualUser
- 11.x 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 \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
- class \Drupal\Core\Plugin\PluginBase extends \Drupal\Component\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait
- class \Drupal\Core\Executable\ExecutablePluginBase extends \Drupal\Core\Plugin\PluginBase implements \Drupal\Core\Executable\ExecutableInterface, \Drupal\Core\Cache\CacheableDependencyInterface, \Drupal\Core\Plugin\ContextAwarePluginInterface uses \Drupal\Core\Plugin\ContextAwarePluginTrait
- class \Drupal\Core\Condition\ConditionPluginBase extends \Drupal\Core\Executable\ExecutablePluginBase implements \Drupal\Core\Condition\ConditionInterface uses \Drupal\Core\Plugin\ContextAwarePluginAssignmentTrait
- class \Drupal\condition_test\Plugin\Condition\ConditionTestDualUser extends \Drupal\Core\Condition\ConditionPluginBase
- class \Drupal\Core\Condition\ConditionPluginBase extends \Drupal\Core\Executable\ExecutablePluginBase implements \Drupal\Core\Condition\ConditionInterface uses \Drupal\Core\Plugin\ContextAwarePluginAssignmentTrait
- class \Drupal\Core\Executable\ExecutablePluginBase extends \Drupal\Core\Plugin\PluginBase implements \Drupal\Core\Executable\ExecutableInterface, \Drupal\Core\Cache\CacheableDependencyInterface, \Drupal\Core\Plugin\ContextAwarePluginInterface uses \Drupal\Core\Plugin\ContextAwarePluginTrait
- class \Drupal\Core\Plugin\PluginBase extends \Drupal\Component\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait
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.');
}
}
Members
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.