You are here

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

Fetches data based upon the given sub-paths.

Parameters

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

string[] $sub_paths: A list of sub paths; i.e., a property path separated into its parts.

\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::fetchDataBySubPaths()
DataFetcher::fetchDataBySubPaths in src/DataFetcher.php
Fetches data based upon the given sub-paths.

File

src/DataFetcherInterface.php, line 62

Class

DataFetcherInterface
Interface for the DataFetcher service.

Namespace

Drupal\typed_data

Code

public function fetchDataBySubPaths(TypedDataInterface $typed_data, array $sub_paths, BubbleableMetadata $bubbleable_metadata = NULL, $langcode = NULL);