function ConfigImporter::doSyncStep

Same name in other branches
  1. 9 core/lib/Drupal/Core/Config/ConfigImporter.php \Drupal\Core\Config\ConfigImporter::doSyncStep()
  2. 8.9.x core/lib/Drupal/Core/Config/ConfigImporter.php \Drupal\Core\Config\ConfigImporter::doSyncStep()
  3. 11.x core/lib/Drupal/Core/Config/ConfigImporter.php \Drupal\Core\Config\ConfigImporter::doSyncStep()

Calls a config import step.

Parameters

string|callable $sync_step: The step to do. Either a method on the ConfigImporter class or a callable.

array $context: A batch context array. If the config importer is not running in a batch the only array key that is used is $context['finished']. A process needs to set $context['finished'] = 1 when it is done.

Throws

\InvalidArgumentException Exception thrown if the $sync_step can not be called.

1 call to ConfigImporter::doSyncStep()
ConfigImporter::import in core/lib/Drupal/Core/Config/ConfigImporter.php
Imports the changelist to the target storage.

File

core/lib/Drupal/Core/Config/ConfigImporter.php, line 564

Class

ConfigImporter
Defines a configuration importer.

Namespace

Drupal\Core\Config

Code

public function doSyncStep($sync_step, &$context) {
    if ($this->validated) {
        $this->storageComparer
            ->writeMode();
    }
    if (is_string($sync_step) && method_exists($this, $sync_step)) {
        \Drupal::service('config.installer')->setSyncing(TRUE);
        $this->{$sync_step}($context);
    }
    elseif (is_callable($sync_step)) {
        \Drupal::service('config.installer')->setSyncing(TRUE);
        $sync_step($context, $this);
    }
    else {
        throw new \InvalidArgumentException('Invalid configuration synchronization step');
    }
    \Drupal::service('config.installer')->setSyncing(FALSE);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.