function ExecutionMetadataState::fetchDefinitionByPropertyPath
Overrides ExecutionMetadataStateInterface::fetchDefinitionByPropertyPath
File
-
src/
Context/ ExecutionMetadataState.php, line 88
Class
- ExecutionMetadataState
- The state used during configuration time holding data definitions.
Namespace
Drupal\rules\ContextCode
public function fetchDefinitionByPropertyPath($property_path, $langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED) {
try {
// Support global context names as variable name by ignoring points in
// the service name; e.g. @user.current_user_context:current_user.name.
if (isset($property_path[0]) && $property_path[0] == '@') {
[
$service,
$property_path,
] = explode(':', $property_path, 2);
}
$parts = explode('.', $property_path);
$var_name = array_shift($parts);
if (isset($service)) {
$var_name = $service . ':' . $var_name;
}
return $this->getDataFetcher()
->fetchDefinitionBySubPaths($this->getDataDefinition($var_name), $parts, $langcode);
} catch (TypedDataException $e) {
// Pass on the original exception in the exception trace.
throw new IntegrityException($e->getMessage(), 0, $e);
}
}