You are here

protected function WebformScheduledTaskForm::createPluginForm in Webform Scheduled Tasks 8.2

Create a plugin sub-form.

Parameters

string $key: The key that will be used to store this plugin form.

string $label: The label of the section.

\Drupal\Core\Plugin\PluginFormInterface $plugin: The plugin to add a form for.

array $parent_form: The parent form.

\Drupal\Core\Form\FormStateInterface $form_state: The parent form state.

Return value

array A sub-form.

1 call to WebformScheduledTaskForm::createPluginForm()
WebformScheduledTaskForm::form in src/Form/WebformScheduledTaskForm.php
Gets the actual form array to be built.

File

src/Form/WebformScheduledTaskForm.php, line 233

Class

WebformScheduledTaskForm
The scheduled task form.

Namespace

Drupal\webform_scheduled_tasks\Form

Code

protected function createPluginForm($key, $label, PluginFormInterface $plugin, array $parent_form, FormStateInterface $form_state) {
  $form = [
    '#parents' => [
      $key,
    ],
    '#type' => 'details',
    '#open' => TRUE,
    '#tree' => TRUE,
    '#title' => $label,
  ];
  $parent_form['#parents'] = [];
  $sub_form_state = SubformState::createForSubform($form, $parent_form, $form_state);
  $form += $plugin
    ->buildConfigurationForm($form, $sub_form_state);
  return $form;
}