function drush_load_engine

8.0.x drush_load_engine($type, $engine, $config = array())
6.x drush_load_engine($type, $engine, $version = NULL, $path = NULL, $engine_config = NULL)
7.x drush_load_engine($type, $engine, $config = array())
master drush_load_engine($type, $engine, $config = array())

Loads and validate an engine of the given type.

6 calls to drush_load_engine()
drush_format in includes/
Prepares a variable for printing. Loads the requested output formatter and uses it to process the provided input.
drush_handle_command_output in includes/
Convert the structured output array provided from the Drush command into formatted output. Output is only printed for commands that define 'default-format' &/or 'default-pipe-format'; all other commands are expected to do…
drush_load_command_engine in includes/
Selects and loads an engine implementing the given type.
drush_outputformat_list::validate in commands/core/outputformat/
drush_outputformat_variables::validate in commands/core/outputformat/

... See full list


includes/, line 419
The drush engines API implementation and helpers.


function drush_load_engine($type, $engine, $version = NULL, $path = NULL, $engine_config = NULL) {
  $engine_info = drush_get_engines($type);
  $selected_engine = drush_find_engine_to_use($engine_config, $engine_info, $engine);
  if (!array_key_exists($selected_engine, $engine_info['engines'])) {
    return drush_set_error('DRUSH_UNKNOWN_ENGINE_TYPE', dt('Unknown !engine_type engine !engine', array('!engine' => $selected_engine, '!engine_type' => $type)));

  $result = drush_include_engine($type, $selected_engine, $version, $path, $engine_config);
  if (is_object($result)) {
    $valid = method_exists($result, 'validate') ? $result->validate() : TRUE;
    if ($valid) {
      drush_set_engine($type, $result);
  else {
    $function = strtr($type, '-', '_') . '_validate';
    $valid = function_exists($function) ? call_user_func($function) : TRUE;
  if (!$valid) {
    return FALSE;
  return $result;