You are here

function modules_weight_admin_config_page_form in Modules weight 7

Form constructor for Module Weight form.

Parameters

array $form: The form element.

array $form_state: The form state.

1 string reference to 'modules_weight_admin_config_page_form'
modules_weight_menu in ./modules_weight.module
Implements hook_menu().

File

./modules_weight.admin.inc, line 16
Calls results to administration's pages.

Code

function modules_weight_admin_config_page_form(array $form, array &$form_state) {
  $form['modules']['#tree'] = TRUE;

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

  // Getting the config to know if we should show or not the core modules.
  $show_system_modules = variable_get('modules_weight_show_system_modules');

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

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

    // The rows info.
    // Module name.
    $form['modules'][$module_name]['name'] = array(
      '#markup' => $module['name'],
    );

    // Module description.
    $form['modules'][$module_name]['description'] = array(
      '#markup' => $module['description'],
    );

    // Module weight.
    $form['modules'][$module_name]['weight'] = array(
      '#type' => 'weight',
      '#default_value' => $module['weight'],
      '#delta' => _modules_weight_prepare_delta($module['weight']),
    );

    // Module package.
    $form['modules'][$module_name]['package'] = array(
      '#markup' => $module['package'],
    );
  }

  // The form button.
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save Changes'),
  );
  return $form;
}