You are here

function farm_install_configure_form in farmOS 7

Form callback for farmOS configuration install task.

File

./farm.install, line 97
farmOS install file.

Code

function farm_install_configure_form($form, &$form_state) {

  // Set the page title.
  drupal_set_title(st('Configure farmOS'));

  // Load the list of available modules.
  $modules = farm_modules();

  // Allow user to choose which high-level farm modules to install.
  $module_options = array_merge($modules['default'], $modules['optional']);

  // Default modules will be selected by default.
  $module_defaults = array_keys($modules['default']);
  $form['farm_modules'] = array(
    '#type' => 'checkboxes',
    '#title' => st('farmOS Modules'),
    '#description' => st('Select the farmOS modules that you would like installed by default.'),
    '#options' => $module_options,
    '#default_value' => $module_defaults,
  );

  // Allow the user to select their default system of measurement.
  $form['farm_quantity_unit_system'] = array(
    '#type' => 'radios',
    '#title' => t('System of measurement'),
    '#description' => t('Select the system of measurement you would like to use in farmOS.'),
    '#options' => array(
      'metric' => t('Metric'),
      'us' => t('US/Imperial'),
    ),
    '#default_value' => variable_get('farm_quantity_unit_system', 'metric'),
  );

  // Allow the user to enter a Google Maps API key.
  $form['farm_map_google_api_key'] = array(
    '#type' => 'textfield',
    '#title' => t('Google Maps API Key'),
    '#description' => t('Google Maps layers require that you obtain an API key. Refer to the <a href="@doc">Google Maps API Key</a> documentation on farmOS.org for instructions.', array(
      '@doc' => 'https://farmos.org/hosting/googlemaps',
    )) . ' ' . t('This can also be done after installation.'),
    '#default_value' => variable_get('farm_map_google_api_key', ''),
  );

  // Allow the user to enter a Mapbox API key.
  $form['farm_map_mapbox_api_key'] = array(
    '#type' => 'textfield',
    '#title' => t('Mapbox API Key'),
    '#description' => t('Enter your Mapbox API key.') . ' ' . t('This can also be done after installation.'),
    '#default_value' => variable_get('farm_map_mapbox_api_key', ''),
  );

  // Form actions.
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => st('Continue'),
  );

  // Return the form.
  return $form;
}