You are here

function patterns_io_load_components in Patterns 7

Same name and namespace in other branches
  1. 7.2 includes/io/io.inc \patterns_io_load_components()

Loads the Patterns handlers (component) from the filesystem, if they are not already loaded.

Parameters

bool $reset (optional) If TRUE, always forces reloading: the components from the file system. Defaults FALSE

bool $dryrun (optional) If TRUE, it does not actually load: the components, but just returns the paths to each of them. Defaults FALSE

Return value

Array $components Array containing the paths of the components files.

11 calls to patterns_io_load_components()
drush_patterns_export in ./patterns.drush.inc
Export data from the patterns components to file, zip archive, or database
patterns_batch_action in includes/core/batch.inc
Executes a batch action.
patterns_enable_pattern_submit in ./patterns.module
Form submission handler for patterns_enable_pattern().
patterns_export in patterns_export/patterns_export.module
Forms to export the current web site configuration
patterns_export_batch_core in patterns_export/core.inc

... See full list

File

includes/io/io.inc, line 57
Functions related to input/output operations.

Code

function patterns_io_load_components($reset = FALSE, $dryrun = FALSE) {
  $components =& drupal_static(__FUNCTION__);
  if (isset($paths) && !$reset) {
    return $components;
  }
  $components = array();

  // Get list of directories to scan for components.
  $paths = module_invoke_all('patterns_components');
  foreach ($paths as $path) {
    foreach (file_scan_directory($path, '/\\.inc$/') as $file) {
      $components[] = $file->uri;
      if ($dryrun) {
        continue;
      }
      require_once $file->uri;
    }
  }
  return $components;
}