You are here

function coder_upgrade_directories_build in Coder 7.2

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

Returns form content for directories tab.

Parameters

array $directories: User selections or default values.

Return value

array Form item.

1 call to coder_upgrade_directories_build()
coder_upgrade_conversions_form in coder_upgrade/includes/conversion.inc
Form builder for the module conversion form.

File

coder_upgrade/includes/conversion.inc, line 163

Code

function coder_upgrade_directories_build(&$directories) {

  // Build the directory list.
  $deadwood_dir = variable_get('coder_upgrade_dir_old', DEADWOOD_OLD);
  $dirs = coder_upgrade_directory_list();
  $header = array(
    'name' => array(
      'data' => t('Name'),
      'field' => 'name',
    ),
    'path' => array(
      'data' => t('Location'),
      'field' => 'path',
    ),
  );
  $i = 0;
  $rows = array();
  foreach ($dirs as $dir) {
    $row = array();
    $row['name'] = isset($directories[$dir]) ? l($dir, coder_upgrade_patch_link($dir), array(
      'attributes' => array(
        'target' => '_blank',
      ),
    )) : $dir;
    $row['path'] = $deadwood_dir . '/' . $dir;
    $row['#weight'] = ++$i;
    $rows[$dir] = $row;
  }
  $directory_fs = array(
    '#type' => 'fieldset',
    '#title' => t('Directories'),
    '#description' => t('... residing in the selected directories (beneath the files directory), or ...'),
    '#tree' => TRUE,
  );
  $directory_fs['list'] = array(
    '#type' => 'tableselect',
    '#header' => $header,
    '#options' => $rows,
    '#default_value' => isset($directories) ? $directories : array(),
    '#empty' => t('No directories available'),
  );
  return $directory_fs;
}