public function GatsbyPreview::isPreviewEntity in Gatsby Live Preview & Incremental Builds 8
Same name and namespace in other branches
- 2.0.x src/GatsbyPreview.php \Drupal\gatsby\GatsbyPreview::isPreviewEntity()
Verify the entity is selected to sync to the Gatsby site.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity: The entity.
Return value
bool If the entity type should be sent to Gatsby Preview.
File
- src/
GatsbyPreview.php, line 138
Class
- GatsbyPreview
- Defines a class for generating Gatsby based previews.
Namespace
Drupal\gatsbyCode
public function isPreviewEntity(ContentEntityInterface $entity) {
$entityType = $entity
->getEntityTypeId();
$selectedEntityTypes = $this->configFactory
->get('gatsby.settings')
->get('preview_entity_types') ?: [];
return in_array($entityType, array_values($selectedEntityTypes), TRUE);
}