You are here

function _social_like_set_defaults in Open Social 10.2.x

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

Set default config.

1 call to _social_like_set_defaults()
social_like_install in modules/social_features/social_like/social_like.install
Implements hook_install().

File

modules/social_features/social_like/social_like.install, line 83
Install, update and uninstall functions for the social_like module.

Code

function _social_like_set_defaults() {

  // Add like and dislike settings.

  /** @var \Drupal\Core\Config\Config|\Drupal\Core\Config\ImmutableConfig $config */
  $container = \Drupal::getContainer()
    ->get('config.factory');
  $config = $container
    ->getEditable('like_and_dislike.settings');
  $config
    ->set('hide_vote_widget', TRUE)
    ->save();
  $config
    ->set('enabled_types', [
    'comment' => [
      'comment',
      'post_comment',
    ],
    'node' => [
      'topic',
      'event',
    ],
    'post' => [
      'post',
    ],
  ])
    ->save();

  // Add voting api settings.
  $config = $container
    ->getEditable('like_and_dislike.settings');
  $config
    ->set('delete_everywhere', FALSE)
    ->save();
}