You are here

public static function Flow::getAll in CMS Content Sync 2.1.x

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

Load all entities.

Load all cms_content_sync_flow entities and add overrides from global $config.

Parameters

bool $skip_inactive: Do not return inactive flows by default

Return value

Flow[]

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

44 calls to Flow::getAll()
CliService::configuration_export in src/Cli/CliService.php
Export the configuration to the Sync Core.
CliService::configuration_export in modules/cms_content_sync_developer/src/Cli/CliService.php
Update the local entity type versions, so add unknown fields for example.
CliService::pull in src/Cli/CliService.php
Kindly ask the Sync Core to pull all entities for a specific flow, or to force pull one specific entity.
CliService::pull_entities in src/Cli/CliService.php
Kindly ask the Sync Core to pull all entities for a specific flow.
CliService::push in src/Cli/CliService.php
Push all entities for a specific flow.

... See full list

File

src/Entity/Flow.php, line 352

Class

Flow
Defines the "Content Sync - Flow" entity.

Namespace

Drupal\cms_content_sync\Entity

Code

public static function getAll($skip_inactive = true, $rebuild = false) {
  if ($skip_inactive && null !== self::$all && !$rebuild) {
    return self::$all;
  }

  /**
   * @var Flow[] $configurations
   */
  $configurations = \Drupal::entityTypeManager()
    ->getStorage('cms_content_sync_flow')
    ->loadMultiple();
  foreach ($configurations as $id => &$configuration) {
    global $config;
    $config_name = 'cms_content_sync.flow.' . $id;
    if (!isset($config[$config_name]) || empty($config[$config_name])) {
      continue;
    }
    foreach ($config[$config_name] as $key => $new_value) {
      if (in_array($key, [
        'per_bundle_settings',
        'simple_settings',
      ])) {
        $configuration->{$key} = array_merge_recursive($configuration->{$key}, $new_value);
        continue;
      }
      $configuration
        ->set($key, $new_value);
    }

    // Calculate 'version' property if missing.
    $configuration
      ->getController()
      ->getEntityTypeConfig();
  }
  if ($skip_inactive) {
    $result = [];
    foreach ($configurations as $id => $flow) {
      if ($flow
        ->get('status')) {
        $result[$id] = $flow;
      }
    }
    $configurations = $result;
    self::$all = $configurations;
  }
  return $configurations;
}