function gatsby_entity_update in Gatsby Live Preview & Incremental Builds 8
Same name and namespace in other branches
- 2.0.x gatsby.module \gatsby_entity_update()
Implements hook_entity_update().
File
- ./
gatsby.module, line 139 - Contains gatsby.module.
Code
function gatsby_entity_update(EntityInterface $entity) {
// Don't run entity_updates if gatsby_endpoints is enabled.
$moduleHandler = \Drupal::service('module_handler');
if ($moduleHandler
->moduleExists('gatsby_endpoints')) {
return;
}
$gatsbyPreview = \Drupal::service('gatsby.gatsby_preview');
if (!$entity instanceof ContentEntityInterface || !$gatsbyPreview
->isPreviewEntity($entity)) {
return;
}
if (!$gatsbyPreview
->isConfigured()) {
return;
}
$gatsbyPreview
->gatsbyPrepareData($entity);
drupal_register_shutdown_function('_gatsby_update');
}