You are here

function _social_add_demo_batch in Open Social 8.3

Same name and namespace in other branches
  1. 8.9 social.profile \_social_add_demo_batch()
  2. 8 social.profile \_social_add_demo_batch()
  3. 8.2 social.profile \_social_add_demo_batch()
  4. 8.4 social.profile \_social_add_demo_batch()
  5. 8.5 social.profile \_social_add_demo_batch()
  6. 8.6 social.profile \_social_add_demo_batch()
  7. 8.7 social.profile \_social_add_demo_batch()
  8. 8.8 social.profile \_social_add_demo_batch()
  9. 10.3.x social.profile \_social_add_demo_batch()
  10. 10.0.x social.profile \_social_add_demo_batch()
  11. 10.1.x social.profile \_social_add_demo_batch()
  12. 10.2.x social.profile \_social_add_demo_batch()

Implements callback_batch_operation().

Performs batch demo content generation.

1 string reference to '_social_add_demo_batch'
social_final_site_setup in ./social.profile
Final setup of Social profile.

File

./social.profile, line 416
Enables modules and site configuration for a social site installation.

Code

function _social_add_demo_batch($demo_type, $demo_description, &$context) {
  set_time_limit(0);
  $num_created = 0;
  $content_types = [
    $demo_type,
  ];
  $manager = \Drupal::service('plugin.manager.demo_content');
  $plugins = $manager
    ->createInstances($content_types);

  /** @var \Drupal\social_demo\DemoContentInterface $plugin */
  foreach ($plugins as $plugin) {
    $plugin
      ->createContent();
    $num_created = $plugin
      ->count();
  }
  $context['results'][] = $demo_type;
  $context['message'] = t('Generated %num %demo_description.', [
    '%num' => $num_created,
    '%demo_description' => $demo_description,
  ]);
}