You are here

function drush_modules_weight_mw_list in Modules weight 7

Same name and namespace in other branches
  1. 8.2 modules_weight.drush.inc \drush_modules_weight_mw_list()
  2. 8 modules_weight.drush.inc \drush_modules_weight_mw_list()

Callback for the mw-list command.

File

./modules_weight.drush.inc, line 227
Drush commands related to the Modules weight module.

Code

function drush_modules_weight_mw_list() {
  $result = array();

  // Loading the helper functions file.
  module_load_include('inc', 'modules_weight', 'modules_weight.helpers');

  // Getting the --force option.
  $force = (bool) drush_get_option('force');

  // If we don't force we need to check the configuration variable to know if we
  // should show or not the core modules.
  $show_core_modules = $force ?: variable_get('modules_weight_show_system_modules');

  // Getting the module list.
  $modules = _modules_weight_modules_list($show_core_modules);

  // Iterate over each of the modules.
  foreach ($modules as $filename => $module) {

    // The rows info.
    $row = array();

    // Module name.
    $row['name'] = $module['name'];

    // Module machine name.
    $row['machine_name'] = $filename;

    // Module weight.
    $row['weight'] = $module['weight'];

    // Module package.
    $row['package'] = $module['package'];
    $result[] = $row;
  }
  return $result;
}