public function FieldsHelper::retrieveNestedProperty in Search API 8
Retrieves a nested property from a list of properties.
Parameters
\Drupal\Core\TypedData\DataDefinitionInterface[] $properties: The base properties, keyed by property name.
string $propertyPath: The property path of the property to retrieve.
Return value
\Drupal\Core\TypedData\DataDefinitionInterface|null The requested property, or NULL if it couldn't be found.
Overrides FieldsHelperInterface::retrieveNestedProperty
File
- src/
Utility/ FieldsHelper.php, line 354
Class
- FieldsHelper
- Provides helper methods for dealing with Search API fields and properties.
Namespace
Drupal\search_api\UtilityCode
public function retrieveNestedProperty(array $properties, $propertyPath) {
list($key, $nestedPath) = Utility::splitPropertyPath($propertyPath, FALSE);
if (!isset($properties[$key])) {
return NULL;
}
$property = $this
->getInnerProperty($properties[$key]);
if ($nestedPath === NULL) {
return $property;
}
if (!$property instanceof ComplexDataDefinitionInterface) {
return NULL;
}
return $this
->retrieveNestedProperty($this
->getNestedProperties($property), $nestedPath);
}