function drush_social_demo_demo_content_remove in Open Social 8
Same name and namespace in other branches
- 8.9 modules/custom/social_demo/social_demo.drush.inc \drush_social_demo_demo_content_remove()
- 8.2 modules/custom/social_demo/social_demo.drush.inc \drush_social_demo_demo_content_remove()
- 8.3 modules/custom/social_demo/social_demo.drush.inc \drush_social_demo_demo_content_remove()
- 8.4 modules/custom/social_demo/social_demo.drush.inc \drush_social_demo_demo_content_remove()
- 8.5 modules/custom/social_demo/social_demo.drush.inc \drush_social_demo_demo_content_remove()
- 8.6 modules/custom/social_demo/social_demo.drush.inc \drush_social_demo_demo_content_remove()
- 8.7 modules/custom/social_demo/social_demo.drush.inc \drush_social_demo_demo_content_remove()
- 8.8 modules/custom/social_demo/social_demo.drush.inc \drush_social_demo_demo_content_remove()
- 10.3.x modules/custom/social_demo/social_demo.drush.inc \drush_social_demo_demo_content_remove()
- 10.0.x modules/custom/social_demo/social_demo.drush.inc \drush_social_demo_demo_content_remove()
- 10.1.x modules/custom/social_demo/social_demo.drush.inc \drush_social_demo_demo_content_remove()
- 10.2.x modules/custom/social_demo/social_demo.drush.inc \drush_social_demo_demo_content_remove()
Removes demo content.
1 string reference to 'drush_social_demo_demo_content_remove'
- drush_social_demo_remove in modules/
custom/ social_demo/ social_demo.drush.inc - Remove demo content.
File
- modules/
custom/ social_demo/ social_demo.drush.inc, line 102 - Contains social_demo.drush.inc.
Code
function drush_social_demo_demo_content_remove() {
\Drupal::currentUser()
->setAccount(User::load(1));
$content_types = func_get_args();
$profile = drush_get_option('profile', '');
$manager = \Drupal::service('plugin.manager.demo_content');
$plugins = $manager
->createInstances($content_types);
/** @var \Drupal\social_demo\DemoContentInterface $plugin */
foreach ($plugins as $plugin) {
$definition = $plugin
->getPluginDefinition();
$plugin
->setProfile($profile);
$plugin
->removeContent();
drush_log("{$definition['label']}(s) removed", LogLevel::SUCCESS);
}
}