You are here

public function GatsbyPreview::gatsbyPrepareDelete in Gatsby Live Preview & Incremental Builds 2.0.x

Same name and namespace in other branches
  1. 8 src/GatsbyPreview.php \Drupal\gatsby\GatsbyPreview::gatsbyPrepareDelete()

Prepares Gatsby Deletes to send to the preview and build servers.

This is a separate method to allow overriding services to override the delete method to add additional data.

1 method overrides GatsbyPreview::gatsbyPrepareDelete()
GatsbyInstantPreview::gatsbyPrepareDelete in modules/gatsby_instantpreview/src/GatsbyInstantPreview.php
Triggers the refreshing of Gatsby preview and incremental builds.

File

src/GatsbyPreview.php, line 111

Class

GatsbyPreview
Defines a class for generating Gatsby based previews.

Namespace

Drupal\gatsby

Code

public function gatsbyPrepareDelete(ContentEntityInterface $entity = NULL) {
  $json = [
    'id' => $entity
      ->uuid(),
    'action' => 'delete',
  ];
  $settings = $this->configFactory
    ->get('gatsby.settings');
  $preview_url = $settings
    ->get('preview_callback_url');
  if ($preview_url) {
    $this
      ->updateData('preview', $preview_url, $json);
  }
  $incrementalbuild_url = $settings
    ->get('incrementalbuild_url');
  if ($incrementalbuild_url) {
    $this
      ->updateData('incrementalbuild', $incrementalbuild_url, $json);
  }
}