You are here

function realistic_dummy_content_api_apply_recipe in Realistic Dummy Content 7.2

Same name and namespace in other branches
  1. 8.2 api/realistic_dummy_content_api.module \realistic_dummy_content_api_apply_recipe()
  2. 8 api/realistic_dummy_content_api.module \realistic_dummy_content_api_apply_recipe()
  3. 7 api/realistic_dummy_content_api.module \realistic_dummy_content_api_apply_recipe()
  4. 3.x api/realistic_dummy_content_api.module \realistic_dummy_content_api_apply_recipe()

Attempts to generate all realistic content for the current site.

Parameters

object $log: An object of a class which implements the interface RealisticDummyContentLogInterface. Logging will be different if you are using drush or in the context of an automated test, for example.

2 calls to realistic_dummy_content_api_apply_recipe()
drush_realistic_dummy_content_api_generate_realistic in api/realistic_dummy_content_api.drush.inc
Callback: Generates realistic content.
RealisticDummyContentDatabaseTestCase::testRecipe in api/drupal7-simpletests/RealisticDummyContentDatabaseTestCase.test

File

api/realistic_dummy_content_api.module, line 373
API code allowing other modules to generate realistic dummy content.

Code

function realistic_dummy_content_api_apply_recipe($log) {
  try {
    if (!class_exists('\\Drupal\\realistic_dummy_content_api\\includes\\RealisticDummyContentRecipe')) {
      throw new \Exception('Cannot find the class \\Drupal\\realistic_dummy_content_api\\includes\\RealisticDummyContentRecipe, this might be solved by uninstalling and reinstalling realistic_dummy_content or rebuilding the registry (Drupal 7), and has been known to happen when upgrading from beta3.');
    }
    RealisticDummyContentRecipe::run($log);
  } catch (Exception $e) {
    $log
      ->log('An exception occurred while trying to apply a recipe');
    $log
      ->error($e
      ->getMessage());
  }
}