You are here

public static function TomeSyncHelper::getContentName in Tome 8

Gets the content name for a given entity.

This can be used to read/write from the tome_sync.storage.content service.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: An entity.

Return value

string A string representing the content name.

17 calls to TomeSyncHelper::getContentName()
ContentHasherEventSubscriber::deleteHash in modules/tome_sync/src/EventSubscriber/ContentHasherEventSubscriber.php
Maintains a hash of imported content to support partial imports.
ContentHasherEventSubscriber::writeHash in modules/tome_sync/src/EventSubscriber/ContentHasherEventSubscriber.php
Maintains a hash of imported content to support partial imports.
ContentHasherEventSubscriber::writeSourceHash in modules/tome_sync/src/EventSubscriber/ContentHasherEventSubscriber.php
Maintains a hash of exported content to support partial imports.
ContentHasherTest::testContentHasher in modules/tome_sync/tests/src/Kernel/ContentHasherTest.php
@covers \Drupal\tome_sync\ContentHasher::writeHash @covers \Drupal\tome_sync\EventSubscriber\ContentHasherEventSubscriber::writeHash
ContentIndexerTrait::indexContent in modules/tome_sync/src/ContentIndexerTrait.php
Writes content to the index.

... See full list

File

modules/tome_sync/src/TomeSyncHelper.php, line 26

Class

TomeSyncHelper
Provides helpers for the Tome Sync module.

Namespace

Drupal\tome_sync

Code

public static function getContentName(EntityInterface $entity) {
  if ($entity instanceof TranslatableInterface && !$entity
    ->isDefaultTranslation()) {
    return "{$entity->getEntityTypeId()}.{$entity->uuid()}.{$entity->language()->getId()}";
  }
  else {
    return "{$entity->getEntityTypeId()}.{$entity->uuid()}";
  }
}