You are here

function social_event_update_8902 in Open Social 10.3.x

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

Add a new block to display notifications for event requests.

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

File

modules/social_features/social_event/social_event.install, line 1579
Install, update and uninstall functions for the social_event module.

Code

function social_event_update_8902() {
  $config_files = [
    'block.block.eventrequestsnotification' => drupal_get_path('module', 'social_event') . '/config/static/block.block.eventrequestsnotification_8901.yml',
    'block.block.eventrequestsnotification_2' => drupal_get_path('module', 'social_event') . '/config/static/block.block.eventrequestsnotification_2_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);
      }
    }
  }
}