You are here

public function FlowControllerPerBundle::needsEntityTypeUpdate in CMS Content Sync 2.1.x

@inheritDoc

Overrides IFlowController::needsEntityTypeUpdate

File

src/Controller/FlowControllerPerBundle.php, line 172

Class

FlowControllerPerBundle

Namespace

Drupal\cms_content_sync\Controller

Code

public function needsEntityTypeUpdate() {

  // Show version mismatch warning.
  $entity_type_configs = $this
    ->getEntityTypeConfig(null, null, true);

  // Get version from config.
  $flow_config = \Drupal::config('cms_content_sync.flow.' . $this->flow
    ->id());
  foreach ($entity_type_configs as $entity_type => $bundles) {
    foreach ($bundles as $bundle => $entity_type_config) {

      // Get active version.
      $active_version = Flow::getEntityTypeVersion($entity_type, $bundle);

      // Get config version.
      $config_version = $flow_config
        ->get('per_bundle_settings.' . $entity_type . '.' . $bundle . '.settings.version');
      if ($active_version != $config_version) {
        return true;
      }
    }
  }
  return false;
}