You are here

function bibcite_entity_update_8003 in Bibliography & Citation 8

Same name and namespace in other branches
  1. 2.0.x modules/bibcite_entity/bibcite_entity.install \bibcite_entity_update_8003()

Install new optional configuration (administration views).

File

modules/bibcite_entity/bibcite_entity.install, line 55
Module installation hooks implementation.

Code

function bibcite_entity_update_8003() {

  /** @var \Drupal\Core\Config\ConfigInstallerInterface $installer */
  $installer = \Drupal::service('config.installer');
  $configs = [
    'system.action.bibcite_contributor_delete',
    'system.action.bibcite_contributor_save',
    'system.action.bibcite_keyword_delete',
    'system.action.bibcite_keyword_save',
    'system.action.bibcite_reference_delete',
    'system.action.bibcite_reference_save',
  ];
  $update_required = FALSE;
  foreach ($configs as $config_name) {
    $config = \Drupal::config($config_name);
    if ($config
      ->isNew()) {
      $update_required = TRUE;
      break;
    }
  }
  if ($update_required) {
    $installer
      ->installDefaultConfig('module', 'bibcite_entity');
  }
  $path = drupal_get_path('module', 'bibcite_entity') . '/' . InstallStorage::CONFIG_OPTIONAL_DIRECTORY;
  $storage = new FileStorage($path);
  $installer
    ->installOptionalConfig($storage);
}