You are here

function coder_upgrade_extensions_build in Coder 7

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

Returns form content for file extensions tab.

Parameters

array $extensions: User selections or default values.

Return value

array Form item.

1 call to coder_upgrade_extensions_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 111

Code

function coder_upgrade_extensions_build(&$extensions) {

  // Build the file extension list.
  $types = array(
    'inc' => 'PHP code files',
    'info' => 'Info files used with module installation',
    'install' => 'PHP code files used with module installation, update and uninstallation',
    'module' => 'PHP code files',
    'php' => 'PHP code files',
    'profile' => 'PHP code files used with site installation',
    'test' => 'SimpleTest files',
    'theme' => 'PHP code files used with theming',
  );
  $header = array(
    'extension' => array(
      'data' => t('Extension'),
      'field' => 'extension',
    ),
    'description' => array(
      'data' => t('Description'),
      'field' => 'description',
    ),
  );
  $i = 0;
  $rows = array();
  foreach ($types as $key => $description) {
    $row = array();
    $row['extension'] = $key;
    $row['description'] = $description;
    $row['#weight'] = ++$i;
    $rows[$key] = $row;
  }
  $extension_fs = array(
    '#type' => 'fieldset',
    '#title' => t('Extensions'),
    '#description' => t('... to files with the selected file extensions ...'),
    '#tree' => TRUE,
  );
  $extension_fs['list'] = array(
    '#type' => 'tableselect',
    '#header' => $header,
    '#options' => $rows,
    '#default_value' => isset($extensions) ? $extensions : array(),
    '#empty' => t('No extensions available'),
  );
  return $extension_fs;
}