You are here

public function DataFetcherInterface::fetchDataByPropertyPath in Typed Data API enhancements 8

Fetches data based upon the given property path.

Parameters

\Drupal\Core\TypedData\TypedDataInterface $typed_data: The data from which to select a value.

string $property_path: The property path string, e.g. "uid.entity.mail.value".

\Drupal\Core\Render\BubbleableMetadata|null $bubbleable_metadata: (optional) An object to which required bubbleable metadata will be added.

string $langcode: (optional) The language code used to get the argument value if the argument value should be translated. Defaults to NULL.

Return value

\Drupal\Core\TypedData\TypedDataInterface The variable wrapped as typed data.

Throws

\Drupal\Core\TypedData\Exception\MissingDataException Thrown if the data cannot be fetched due to missing data; e.g., unset properties or list items.

\Drupal\typed_data\Exception\InvalidArgumentException Thrown if the given path is not valid for the given data; e.g., a not existing property is referenced.

1 method overrides DataFetcherInterface::fetchDataByPropertyPath()
DataFetcher::fetchDataByPropertyPath in src/DataFetcher.php
Fetches data based upon the given property path.

File

src/DataFetcherInterface.php, line 37

Class

DataFetcherInterface
Interface for the DataFetcher service.

Namespace

Drupal\typed_data

Code

public function fetchDataByPropertyPath(TypedDataInterface $typed_data, $property_path, BubbleableMetadata $bubbleable_metadata = NULL, $langcode = NULL);