You are here

function _bootstrap_layouts_update in Bootstrap Layouts 8.4

Same name and namespace in other branches
  1. 8.5 bootstrap_layouts.install \_bootstrap_layouts_update()

Runs updates for registered update plugins.

Parameters

int $schema: The schema version to update.

Throws

Exception When the "plugin.manager.bootstrap_layouts" service could not be loaded.

See also

\Drupal\bootstrap_layouts\BootstrapLayoutsManager::update()

2 calls to _bootstrap_layouts_update()
bootstrap_layouts_update_8401 in ./bootstrap_layouts.install
Upgrade existing Bootstrap Layout instances.
bootstrap_layouts_update_8402 in ./bootstrap_layouts.install
Fix "1 Column (stacked)" regions.

File

./bootstrap_layouts.install, line 19
Install, uninstall and update hooks for the Bootstrap Layouts module.

Code

function _bootstrap_layouts_update($schema) {
  $container = \Drupal::getContainer();

  // Rebuild the container if the bootstrap layouts manager doesn't exist.
  if (!$container
    ->has('plugin.manager.bootstrap_layouts')) {
    drupal_flush_all_caches();
  }

  /** @var \Drupal\bootstrap_layouts\BootstrapLayoutsManager $bootstrap_layouts_manager */
  if ($manager = $container
    ->get('plugin.manager.bootstrap_layouts')) {
    $manager
      ->update($schema);
  }
  else {
    throw new Exception('Unable to load the "plugin.manager.bootstrap_layouts" service.');
  }
}