protected function ContentEntity::getPropertyPathDependencies in Search API 8
Computes all dependencies of the given property path.
Parameters
string $property_path: The property path of the property.
\Drupal\Core\TypedData\DataDefinitionInterface[] $properties: The properties which form the basis for the property path.
Return value
string[][] An associative array with the dependencies for the given property path, mapping dependency types to arrays of dependency names.
1 call to ContentEntity::getPropertyPathDependencies()
- ContentEntity::getFieldDependencies in src/
Plugin/ search_api/ datasource/ ContentEntity.php - Retrieves any dependencies of the given fields.
File
- src/
Plugin/ search_api/ datasource/ ContentEntity.php, line 1189
Class
- ContentEntity
- Represents a datasource which exposes the content entities.
Namespace
Drupal\search_api\Plugin\search_api\datasourceCode
protected function getPropertyPathDependencies($property_path, array $properties) {
list($key, $nested_path) = Utility::splitPropertyPath($property_path, FALSE);
if (!isset($properties[$key])) {
return [];
}
$dependencies = new Dependencies();
$property = $properties[$key];
if ($property instanceof FieldConfigInterface) {
$storage = $property
->getFieldStorageDefinition();
if ($storage instanceof FieldStorageConfigInterface) {
$name = $storage
->getConfigDependencyName();
$dependencies
->addDependency($storage
->getConfigDependencyKey(), $name);
}
}
// The field might be provided by a module which is not the provider of the
// entity type, therefore we need to add a dependency on that module.
if ($property instanceof FieldStorageDefinitionInterface) {
$dependencies
->addDependency('module', $property
->getProvider());
}
$property = $this
->getFieldsHelper()
->getInnerProperty($property);
if ($property instanceof EntityDataDefinitionInterface) {
$entity_type_definition = $this
->getEntityTypeManager()
->getDefinition($property
->getEntityTypeId());
if ($entity_type_definition) {
$module = $entity_type_definition
->getProvider();
$dependencies
->addDependency('module', $module);
}
}
if ($nested_path !== NULL && $property instanceof ComplexDataDefinitionInterface) {
$nested = $this
->getFieldsHelper()
->getNestedProperties($property);
$nested_dependencies = $this
->getPropertyPathDependencies($nested_path, $nested);
$dependencies
->addDependencies($nested_dependencies);
}
return $dependencies
->toArray();
}