You are here

protected function DataProviderEntity::initDataInterpreter in RESTful 7.2

Get the data interpreter.

Parameters

mixed $identifier: The ID of thing being viewed.

Return value

\Drupal\restful\Plugin\resource\DataInterpreter\DataInterpreterInterface The data interpreter.

Overrides DataProvider::initDataInterpreter

File

src/Plugin/resource/DataProvider/DataProviderEntity.php, line 1327
Contains \Drupal\restful\Plugin\resource\DataProvider\DataProviderEntity.

Class

DataProviderEntity
Class DataProviderEntity.

Namespace

Drupal\restful\Plugin\resource\DataProvider

Code

protected function initDataInterpreter($identifier) {
  $id = $identifier;
  $entity_id = $this
    ->getEntityIdByFieldId($id);

  /* @var \EntityDrupalWrapper $wrapper */
  $wrapper = entity_metadata_wrapper($this->entityType, $entity_id);
  $wrapper
    ->language($this
    ->getLangCode());
  return new DataInterpreterEMW($this
    ->getAccount(), $wrapper);
}