You are here

public function EntityDataProviderManager::getData in Gutenberg 8

Same name and namespace in other branches
  1. 8.2 src/DataProvider/EntityDataProviderManager.php \Drupal\gutenberg\DataProvider\EntityDataProviderManager::getData()

Get data for specified entity type.

Parameters

string $entity_type: Entity type machine name.

\Drupal\Core\Entity\ContentEntityInterface $entity: Entity instance.

array $data: (optional) Additional data to process.

Return value

mixed The data for the specified entity type.

Throws

\Exception

Overrides EntityDataProviderManagerInterface::getData

File

src/DataProvider/EntityDataProviderManager.php, line 35

Class

EntityDataProviderManager
Supports management for entity type data providers.

Namespace

Drupal\gutenberg\DataProvider

Code

public function getData(string $entity_type, ContentEntityInterface $entity, array $data = []) {
  if (!$this
    ->isRegistered($entity_type)) {
    throw new \Exception(sprintf("Data type doesn't exist for %s entity type.", $entity_type));
  }
  return $this->dataProviders[$entity_type]
    ->getData($entity, $data);
}