You are here

protected function EmailedExport::buildExportPluginForm in Webform Scheduled Tasks 8.2

Build the export plugin form.

1 call to EmailedExport::buildExportPluginForm()
EmailedExport::buildConfigurationForm in src/Plugin/WebformScheduledTasks/Task/EmailedExport.php
Form constructor.

File

src/Plugin/WebformScheduledTasks/Task/EmailedExport.php, line 177

Class

EmailedExport
A task which emails an export of a list of webforms.

Namespace

Drupal\webform_scheduled_tasks\Plugin\WebformScheduledTasks\Task

Code

protected function buildExportPluginForm(&$form, FormStateInterface $form_state) {
  $form['exporter'] = [
    '#title' => $this
      ->t('Export format'),
    '#type' => 'select',
    '#options' => $this->exporterManager
      ->getOptions(),
    '#default_value' => $this->configuration['exporter'],
    '#ajax' => [
      'callback' => [
        static::class,
        'ajaxCallback',
      ],
      'wrapper' => 'exporter-settings',
    ],
  ];
  $chosen_exporter = $form_state
    ->getValue('exporter', $this->configuration['exporter']);
  $plugin = $this->exporterManager
    ->createInstance($chosen_exporter, $this
    ->getConfiguration()['exporter_settings']);
  $form['exporter_settings'] = [
    '#prefix' => '<div id="exporter-settings">',
    '#suffix' => '</div>',
  ];
  $subform_state = SubformState::createForSubform($form['exporter_settings'], $form, $form_state);
  $form['exporter_settings'] += $plugin
    ->buildConfigurationForm($form['exporter_settings'], $subform_state);
}