You are here

function gathercontent_import_form_project_select in GatherContent 7.3

Project select form.

@inheritdoc

1 string reference to 'gathercontent_import_form_project_select'
gathercontent_import_form in ./gathercontent.import.inc
Multistep form function.

File

./gathercontent.import.inc, line 148

Code

function gathercontent_import_form_project_select($form, &$form_state) {
  $gathercontent_module_path = drupal_get_path('module', 'gathercontent');
  $query = db_select('gathercontent_mapping', 'm')
    ->distinct()
    ->fields('m', array(
    'gathercontent_project',
    'gathercontent_project_id',
  ))
    ->isNotNull('data')
    ->execute();
  $projects = $query
    ->fetchAllKeyed(1, 0);
  $form['project'] = array(
    '#type' => 'select',
    '#title' => t('Select project'),
    '#options' => $projects,
    '#empty_option' => t('- Select -'),
    '#empty_value' => 0,
    '#required' => TRUE,
    '#default_value' => isset($form_state['object']->project_id) ? $form_state['object']->project_id : '',
    '#description' => t('You can only see projects with mapped templates in the dropdown.'),
    '#attributes' => array(
      'class' => array(
        'gathercontent-autosubmit',
      ),
    ),
    '#attached' => array(
      'js' => array(
        $gathercontent_module_path . '/js/gathercontent-autosubmit.js',
      ),
    ),
  );
  return $form;
}