You are here

public function ProcessDevelForm::buildForm in Module Builder 8.3

Form constructor.

Overrides FormInterface::buildForm

File

module_builder_devel/src/Form/ProcessDevelForm.php, line 25

Class

ProcessDevelForm
Form for running selected analysis jobs and outputting the result.

Namespace

Drupal\module_builder_devel\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  \Drupal::service('module_builder.drupal_code_builder')
    ->loadLibrary();
  try {
    $task_handler_report = \Drupal::service('module_builder.drupal_code_builder')
      ->getTask('ReportHookDataFolder');
    $task_report_summary = \Drupal::service('module_builder.drupal_code_builder')
      ->getTask('ReportSummary');
    $task_handler_collect = \Drupal::service('module_builder.drupal_code_builder')
      ->getTask('Collect');
  } catch (SanityException $e) {

    // We're in right place to do something about a problem, so no need to
    // show a message.
  }
  $job_list = $this
    ->getJobList($form_state);
  $job_options = [];
  foreach ($job_list as $index => $job) {
    $option_label = isset($job['item_label']) ? "{$job['process_label']} - {$job['item_label']}" : "{$job['process_label']}";
    $job_options[$index] = $option_label;
  }
  $form['jobs'] = [
    '#type' => 'checkboxes',
    '#title' => t('Jobs to process'),
    '#options' => $job_options,
    '#required' => TRUE,
  ];
  $form['submit'] = [
    '#type' => 'submit',
    '#value' => t('Run selected processing jobs'),
  ];
  return $form;
}