You are here

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

@inheritDoc

Overrides IFlowController::getEntityTypeConfig

3 calls to FlowControllerPerBundle::getEntityTypeConfig()
FlowControllerPerBundle::getType in src/Controller/FlowControllerPerBundle.php
FlowControllerPerBundle::needsEntityTypeUpdate in src/Controller/FlowControllerPerBundle.php
@inheritDoc
FlowControllerPerBundle::updateEntityTypeVersions in src/Controller/FlowControllerPerBundle.php
Cache the current version per entity type.

File

src/Controller/FlowControllerPerBundle.php, line 14

Class

FlowControllerPerBundle

Namespace

Drupal\cms_content_sync\Controller

Code

public function getEntityTypeConfig($entity_type = null, $entity_bundle = null, $used_only = false, $include_new_versions = false) {
  $entity_types = $this->flow->per_bundle_settings;
  $result = [];
  if (empty($entity_types)) {
    return $result;
  }
  foreach ($entity_types as $entity_type_name => &$type_bundles) {
    foreach ($type_bundles as $bundle_name => &$bundle) {
      $settings =& $bundle['settings'];
      if ($used_only && Flow::HANDLER_IGNORE == $settings['handler']) {
        continue;
      }
      if ($entity_type && $entity_type_name != $entity_type) {
        continue;
      }
      if ($entity_bundle && $bundle_name != $entity_bundle) {
        continue;
      }

      // If this is called before being saved, we want to have version etc.
      // available still.
      if (empty($settings['version']) || $include_new_versions) {
        $settings['version'] = Flow::getEntityTypeVersion($entity_type_name, $bundle_name);
      }
      if ($entity_type && $entity_bundle) {
        return $settings;
      }
      $result[$entity_type_name][$bundle_name] = $settings;
    }
  }
  return $result;
}