You are here

function activity_basics_update_8103 in Open Social 8

Same name and namespace in other branches
  1. 8.9 modules/custom/activity_basics/activity_basics.install \activity_basics_update_8103()
  2. 8.2 modules/custom/activity_basics/activity_basics.install \activity_basics_update_8103()
  3. 8.3 modules/custom/activity_basics/activity_basics.install \activity_basics_update_8103()
  4. 8.4 modules/custom/activity_basics/activity_basics.install \activity_basics_update_8103()
  5. 8.5 modules/custom/activity_basics/activity_basics.install \activity_basics_update_8103()
  6. 8.6 modules/custom/activity_basics/activity_basics.install \activity_basics_update_8103()
  7. 8.7 modules/custom/activity_basics/activity_basics.install \activity_basics_update_8103()
  8. 8.8 modules/custom/activity_basics/activity_basics.install \activity_basics_update_8103()
  9. 10.3.x modules/custom/activity_basics/activity_basics.install \activity_basics_update_8103()
  10. 10.0.x modules/custom/activity_basics/activity_basics.install \activity_basics_update_8103()
  11. 10.1.x modules/custom/activity_basics/activity_basics.install \activity_basics_update_8103()
  12. 10.2.x modules/custom/activity_basics/activity_basics.install \activity_basics_update_8103()

Replace message template activity_bundle_entity single value with multiple.

File

modules/custom/activity_basics/activity_basics.install, line 35
Install, update and uninstall functions for the activity_basics module.

Code

function activity_basics_update_8103() {
  $message_templates = [
    'create_comment_community_node',
    'create_comment_community_post',
    'create_comment_group_node',
    'create_comment_group_post',
    'create_event_community',
    'create_event_group',
    'create_topic_community',
    'create_topic_group',
    'create_post_community',
    'create_post_group',
    'create_post_profile',
  ];
  foreach ($message_templates as $message_template) {
    $config_name = "message.template.{$message_template}";
    $config = \Drupal::service('config.factory')
      ->getEditable($config_name);
    $activity_bundle_entity = $config
      ->get('third_party_settings.activity_logger.activity_bundle_entity');
    $config
      ->clear('third_party_settings.activity_logger.activity_bundle_entity');
    $bundle_entity = explode('.', $activity_bundle_entity);
    $activity_bundle_entity_new = $bundle_entity[0] . '-' . $bundle_entity[1];
    $activity_bundle_entities = [
      $activity_bundle_entity_new => $activity_bundle_entity_new,
    ];
    $config
      ->set('third_party_settings.activity_logger.activity_bundle_entities', $activity_bundle_entities);
    $config
      ->save();
  }
}