You are here

public static function Flow::getEntityTypeVersion in CMS Content Sync 8

Same name and namespace in other branches
  1. 2.1.x src/Entity/Flow.php \Drupal\cms_content_sync\Entity\Flow::getEntityTypeVersion()
  2. 2.0.x src/Entity/Flow.php \Drupal\cms_content_sync\Entity\Flow::getEntityTypeVersion()

Get a unique version hash for the configuration of the provided entity type and bundle.

Parameters

string $type_name: The entity type in question

string $bundle_name: The bundle in question

Return value

string A 32 character MD5 hash of all important configuration for this entity type and bundle, representing it's current state and allowing potential conflicts from entity type updates to be handled smoothly

20 calls to Flow::getEntityTypeVersion()
CreateStatusEntities::execute in modules/cms_content_sync_migrate_acquia_content_hub/src/CreateStatusEntities.php
Batch create Status Entities for collected nodes.
EntityResource::handleIncomingEntity in src/Plugin/rest/resource/EntityResource.php
EntityStatus::preCreate in src/Entity/EntityStatus.php
Changes the values of an entity before it is created.
EntityStatus::saveSelectedPoolsToPushTo in src/Entity/EntityStatus.php
Flow::createFlow in src/Entity/Flow.php
Create a flow configuration programmatically.

... See full list

File

src/Entity/Flow.php, line 245

Class

Flow
Defines the "Content Sync - Flow" entity.

Namespace

Drupal\cms_content_sync\Entity

Code

public static function getEntityTypeVersion($type_name, $bundle_name) {

  // @todo Include export_config keys in version definition for config entity types like webforms.
  if (EntityHandlerPluginManager::isEntityTypeFieldable($type_name)) {
    $entityFieldManager = \Drupal::service('entity_field.manager');
    $field_definitions = $entityFieldManager
      ->getFieldDefinitions($type_name, $bundle_name);
    $field_definitions_array = (array) $field_definitions;
    unset($field_definitions_array['field_cms_content_synced']);
    $field_names = array_keys($field_definitions_array);
    sort($field_names);
    $version = json_encode($field_names);
  }
  else {
    $version = '';
  }
  return md5($version);
}