ExecutionContextFactory.php
Same filename in other branches
- 8.9.x core/lib/Drupal/Core/TypedData/Validation/ExecutionContextFactory.php
- 10 core/lib/Drupal/Core/TypedData/Validation/ExecutionContextFactory.php
- 10 core/lib/Drupal/Core/Validation/ExecutionContextFactory.php
- 11.x core/lib/Drupal/Core/TypedData/Validation/ExecutionContextFactory.php
- 11.x core/lib/Drupal/Core/Validation/ExecutionContextFactory.php
Namespace
Drupal\Core\TypedData\ValidationFile
-
core/
lib/ Drupal/ Core/ TypedData/ Validation/ ExecutionContextFactory.php
View source
<?php
namespace Drupal\Core\TypedData\Validation;
use Drupal\Core\Validation\TranslatorInterface;
use Symfony\Component\Validator\Context\ExecutionContextFactoryInterface;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use Symfony\Component\Validator\Validator\ValidatorInterface;
/**
* Defines an execution factory for the Typed Data validator.
*
* We do not use the factory provided by Symfony as it is marked internal.
*/
class ExecutionContextFactory implements ExecutionContextFactoryInterface {
/**
* @var \Drupal\Core\Validation\TranslatorInterface
*/
protected $translator;
/**
* @var string|null
*/
protected $translationDomain;
/**
* Constructs a new ExecutionContextFactory instance.
*
* @param \Drupal\Core\Validation\TranslatorInterface $translator
* The translator instance.
* @param string $translationDomain
* (optional) The translation domain.
*/
public function __construct(TranslatorInterface $translator, $translationDomain = NULL) {
$this->translator = $translator;
$this->translationDomain = $translationDomain;
}
/**
* {@inheritdoc}
*/
public function createContext(ValidatorInterface $validator, $root) : ExecutionContextInterface {
return new ExecutionContext($validator, $root, $this->translator, $this->translationDomain);
}
}
Classes
Title | Deprecated | Summary |
---|---|---|
ExecutionContextFactory | Defines an execution factory for the Typed Data validator. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.