You are here

protected function EntityNormalizerTrait::getResourceConfig in JSON:API Extras 8.2

Same name and namespace in other branches
  1. 8 src/Normalizer/EntityNormalizerTrait.php \Drupal\jsonapi_extras\Normalizer\EntityNormalizerTrait::getResourceConfig()

Get the configuration entity based on the entity type and bundle.

Parameters

string $entity_type_id: The entity type ID.

string $bundle_id: The bundle ID.

Return value

\Drupal\Core\Entity\EntityInterface|null The resource config entity or NULL.

File

src/Normalizer/EntityNormalizerTrait.php, line 79

Class

EntityNormalizerTrait
Common code for entity normalizers.

Namespace

Drupal\jsonapi_extras\Normalizer

Code

protected function getResourceConfig($entity_type_id, $bundle_id) {
  $id = sprintf('%s--%s', $entity_type_id, $bundle_id);

  // TODO: Inject this service.
  $resource_config = \Drupal::entityTypeManager()
    ->getStorage('jsonapi_resource_config')
    ->load($id);
  return $resource_config;
}