You are here

function social_profile_update_8901 in Open Social 10.3.x

Same name and namespace in other branches
  1. 10.1.x modules/social_features/social_profile/social_profile.install \social_profile_update_8901()
  2. 10.2.x modules/social_features/social_profile/social_profile.install \social_profile_update_8901()

Add a new block to display filters (social_tagging) on all-members page.

Load in a config file from an specific update hook that will never change.

File

modules/social_features/social_profile/social_profile.install, line 447
Install, update and uninstall functions for the social_profile module.

Code

function social_profile_update_8901() {
  $config_files = [
    'block.block.exposedformnewest_userspage_newest_users' => drupal_get_path('module', 'social_profile') . '/config/static/block.block.exposedformnewest_userspage_newest_users_8901.yml',
    'block.block.socialblue_exposedformnewest_userspage_newest_users' => drupal_get_path('module', 'social_profile') . '/config/static/block.block.socialblue_exposedformnewest_userspage_newest_users_8901.yml',
  ];
  foreach ($config_files as $key => $config_file) {
    if (is_file($config_file)) {
      $settings = Yaml::parse(file_get_contents($config_file));
      if (is_array($settings)) {
        $config = \Drupal::configFactory()
          ->getEditable($key);
        $config
          ->setData($settings)
          ->save(TRUE);
      }
    }
  }
}