Allow to check for the publication status before syncing

Created on 2 October 2024, about 1 month ago

Problem/Motivation

When trying to update an entity, the rdf_sync_entity_update simply does:

function rdf_sync_entity_update(EntityInterface $entity): void {
  $mapper = \Drupal::getContainer()->get('rdf_sync.mapper');
  if ($entity instanceof ContentEntityInterface && $mapper->isMappedEntity($entity)) {
    \Drupal::getContainer()->get('rdf_sync.synchronizer')->synchronize(SyncMethod::UPDATE, [$entity]);
  }
}

The problem in my case is that I do not want draft content to be updated in the RDF endpoint.

Proposed resolution

I could see two easy resolutions here:
1. Allow a flag to be passed to the entity like "skip_sync" which is taken into account by `rdf_sync_entity_update`. The downside with this is that dynamic properties are going to be unsupported I think.
2. Allow a setting per mapped type/bundle, like index_unpublished that only works with entities implementing the \Drupal\Core\Entity\EntityPublishedInterface and is taken into account accordingly.

And one extra case that we maybe be able to provide a possible additional callback in the bundle settings where the object is passed to check for the publication status for any additional check a project might have for the calculation of the publication status.

Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇬🇷Greece idimopoulos

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024