You are here

public function GatsbyInstantPreview::getJson in Gatsby Live Preview & Incremental Builds 2.0.x

Same name and namespace in other branches
  1. 8 modules/gatsby_instantpreview/src/GatsbyInstantPreview.php \Drupal\gatsby_instantpreview\GatsbyInstantPreview::getJson()

Gets the JSON object for an entity.

2 calls to GatsbyInstantPreview::getJson()
GatsbyInstantPreview::buildRelationshipJson in modules/gatsby_instantpreview/src/GatsbyInstantPreview.php
Builds an array of entity JSON data based on entity relationships.
GatsbyInstantPreview::gatsbyPrepareData in modules/gatsby_instantpreview/src/GatsbyInstantPreview.php
Prepares Gatsby Data to send to the preview and build servers.

File

modules/gatsby_instantpreview/src/GatsbyInstantPreview.php, line 245

Class

GatsbyInstantPreview
Defines a class to extend the default preview system with an instant preview.

Namespace

Drupal\gatsby_instantpreview

Code

public function getJson(ContentEntityInterface $entity) {
  try {
    return $this->entityToJsonApi
      ->normalize($entity);
  } catch (RouteNotFoundException $e) {
    return NULL;
  }
}