You are here

public static function RealisticDummyContentRecipe::findObjects in Realistic Dummy Content 3.x

Same name and namespace in other branches
  1. 8.2 api/src/includes/RealisticDummyContentRecipe.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentRecipe::findObjects()
  2. 7.2 api/src/includes/RealisticDummyContentRecipe.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentRecipe::findObjects()

Find all recipe objects defined by all modules.

1 call to RealisticDummyContentRecipe::findObjects()
RealisticDummyContentRecipe::run in api/src/includes/RealisticDummyContentRecipe.php
Run this recipe.

File

api/src/includes/RealisticDummyContentRecipe.php, line 47

Class

RealisticDummyContentRecipe
Abstract base "recipe" class.

Namespace

Drupal\realistic_dummy_content_api\includes

Code

public static function findObjects() {
  $objects = [];

  // We need to cycle through all active modules and look for those
  // which contain a class module_name_realistic_dummy_content_recipe
  // in the file realistic_dummy_content/recipe/module_name.recipe.inc.
  $modules = Framework::instance()
    ->moduleList();
  foreach ($modules as $module) {
    $candidate = $module . '_realistic_dummy_content_recipe';
    if (self::loadRecipeClass($module) && class_exists($candidate)) {
      $objects[] = new $candidate();
    }
  }
  return $objects;
}