You are here

function social_book_update_8801 in Open Social 8.8

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_book/social_book.install \social_book_update_8801()
  2. 10.3.x modules/social_features/social_book/social_book.install \social_book_update_8801()
  3. 10.0.x modules/social_features/social_book/social_book.install \social_book_update_8801()
  4. 10.1.x modules/social_features/social_book/social_book.install \social_book_update_8801()
  5. 10.2.x modules/social_features/social_book/social_book.install \social_book_update_8801()

Config import social_book default configs.

The feature removal script did not succeed for social_book. Import the configs in an update hook.

File

modules/social_features/social_book/social_book.install, line 132
Install, update and uninstall functions for the social_book module.

Code

function social_book_update_8801() {
  $config_files = [
    'core.base_field_override.node.book.promote',
    'core.entity_form_display.node.book.default',
    'core.entity_view_display.node.book.activity_comment',
    'core.entity_view_display.node.book.activity',
    'core.entity_view_display.node.book.default',
    'core.entity_view_display.node.book.hero',
    'core.entity_view_display.node.book.search_index',
    'core.entity_view_display.node.book.teaser',
  ];
  foreach ($config_files as $config_file) {
    $config = drupal_get_path('module', 'social_book') . '/config/features_removal/' . $config_file . '.yml';
    if (is_file($config)) {
      $settings = Yaml::parse(file_get_contents($config));
      if (is_array($settings)) {
        $update_config = \Drupal::configFactory()
          ->getEditable($config_file);
        $update_config
          ->setData($settings)
          ->save(TRUE);
      }
    }
  }
}