public function ConfigImporter::doSyncStep

public ConfigImporter::doSyncStep($sync_step, &$context)

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.

File

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

Class

ConfigImporter
Defines a configuration importer.

Namespace

Drupal\Core\Config

Code

public function doSyncStep($sync_step, &$context) {
  if (!is_array($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);
    call_user_func_array($sync_step, array(&$context, $this));
  }
  else {
    throw new \InvalidArgumentException('Invalid configuration synchronization step');
  }
  \Drupal::service('config.installer')->setSyncing(FALSE);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Config!ConfigImporter.php/function/ConfigImporter::doSyncStep/8.1.x