You are here

public static function Flow::getAll 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::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

31 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
Export the configuration to the Sync Core.
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 516

Class

Flow
Defines the "Content Sync - Flow" entity.

Namespace

Drupal\cms_content_sync\Entity

Code

public static function getAll($skip_inactive = true) {
  if ($skip_inactive && null !== self::$all) {
    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 ('sync_entities' == $key) {
        foreach ($new_value as $sync_key => $options) {
          foreach ($options as $options_key => $setting) {
            if (is_array($setting)) {
              foreach ($setting as $setting_key => $set) {
                $configuration->sync_entities[$sync_key][$options_key][$setting_key] = $set;
              }
            }
            else {
              $configuration->sync_entities[$sync_key][$options_key] = $setting;
            }
          }
        }
        continue;
      }
      $configuration
        ->set($key, $new_value);
    }
    $configuration
      ->getEntityTypeConfig();
  }
  if ($skip_inactive) {
    $result = [];
    foreach ($configurations as $id => $flow) {
      if ($flow
        ->get('status')) {
        $result[$id] = $flow;
      }
    }
    $configurations = $result;
    self::$all = $configurations;
  }
  return $configurations;
}