You are here

function coder_upgrade_general_build in Coder 7.2

Same name and namespace in other branches
  1. 7 coder_upgrade/includes/settings.inc \coder_upgrade_general_build()

Returns form content for general settings tab.

Return value

array Form item.

1 call to coder_upgrade_general_build()
coder_upgrade_settings_form in coder_upgrade/includes/settings.inc
Form builder for the settings form.

File

coder_upgrade/includes/settings.inc, line 33
Provides module conversion settings form.

Code

function coder_upgrade_general_build() {
  require_once DRUPAL_ROOT . '/' . libraries_get_path('grammar_parser') . '/engine/parser.inc';
  $parser = new PGPParser();
  $form = array(
    '#type' => 'fieldset',
    '#title' => t('General'),
    '#description' => t('These settings apply to all modules utilizing the Coder Upgrade conversion routine API.'),
    '#weight' => 0,
  );
  $path = coder_upgrade_directory_path('', FALSE);
  $form['coder_upgrade_dir'] = array(
    '#type' => 'textfield',
    '#title' => t('Module base directory'),
    '#required' => TRUE,
    '#default_value' => variable_get('coder_upgrade_dir', DEADWOOD_DIR),
    '#description' => t('Directory beneath the file system path (@path) in which are housed the old, new and patch directories. Default is @default. In the old directory, place the 6.x module code to be upgraded. The upgraded code is saved to the new directory and patch files are written to the patch directory.', array(
      '@path' => $path,
      '@default' => DEADWOOD_DIR,
    )),
    '#size' => 30,
    '#maxlength' => 255,
    '#validate' => array(
      'coder_upgrade_validate_dir',
    ),
  );
  $form['coder_upgrade_upgrade_core'] = array(
    '#type' => 'checkbox',
    '#title' => t('Update Drupal core modules'),
    '#default_value' => variable_get('coder_upgrade_upgrade_core', FALSE),
    '#description' => t('If checked, then the list of modules to select for upgrade will be the Drupal core modules. Otherwise, the list will be created from contributed modules.'),
  );
  $form['coder_upgrade_replace_files'] = array(
    '#type' => 'checkbox',
    '#title' => t('Replace files'),
    '#default_value' => variable_get('coder_upgrade_replace_files', FALSE),
    '#description' => t('If checked, then the original file will be written to the output directory shown above and then replaced with the upgraded file. Otherwise, the upgraded file will be written to the output directory shown above.'),
  );
  $form['coder_upgrade_preserve_array_format'] = array(
    '#type' => 'checkbox',
    '#title' => t('Preserve array formatting'),
    '#default_value' => variable_get('coder_upgrade_preserve_array_format', FALSE),
    '#description' => t('If checked, then array expressions will be formatted to match the input. If not checked, then array expressions will be formatted per Drupal coding standards. This means array expressions will be inlined in function calls, function parameters, and when a single value. Otherwise, the expression will will be multiline formatted.'),
  );
  $form['coder_upgrade_enable_debug_output'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable debug output from coder upgrade'),
    '#default_value' => variable_get('coder_upgrade_enable_debug_output', FALSE),
    '#description' => t('If checked, then coder upgrade debug output will be written to the file @file. WARNING: This option should NOT be enabled except for testing and development purposes, and then only on smaller files containing the code to be debugged.', array(
      '@file' => coder_upgrade_path('debug'),
    )),
  );
  $form['coder_upgrade_enable_parser_debug_output'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable debug output from grammar parser'),
    '#default_value' => variable_get('coder_upgrade_enable_parser_debug_output', FALSE),
    '#description' => t('If checked, then grammar parser debug output will be written to the file @file. WARNING: This option should NOT be enabled except for testing and development purposes, and then only on smaller files containing the code to be debugged.', array(
      '@file' => $parser
        ->debugPath(),
    )),
  );
  return $form;
}