public function WebformBulkFormBase::buildForm in Webform 8.5
Same name and namespace in other branches
- 6.x src/Form/WebformBulkFormBase.php \Drupal\webform\Form\WebformBulkFormBase::buildForm()
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides FormInterface::buildForm
1 call to WebformBulkFormBase::buildForm()
- WebformSubmissionBulkForm::buildForm in src/
Form/ WebformSubmissionBulkForm.php - Form constructor.
1 method overrides WebformBulkFormBase::buildForm()
- WebformSubmissionBulkForm::buildForm in src/
Form/ WebformSubmissionBulkForm.php - Form constructor.
File
- src/
Form/ WebformBulkFormBase.php, line 65
Class
- WebformBulkFormBase
- Provides the webform bulk form base.
Namespace
Drupal\webform\FormCode
public function buildForm(array $form, FormStateInterface $form_state, $table = []) {
$form['#attributes']['class'][] = 'webform-bulk-form';
$options = $this
->getBulkOptions();
if (empty($options)) {
return [
'items' => $table,
];
}
// Operations.
$form['operations'] = [
'#prefix' => '<div class="container-inline">',
'#suffix' => '</div>',
];
$form['operations']['action'] = [
'#type' => 'select',
'#title' => $this
->t('Action'),
'#title_display' => 'invisible',
'#options' => $this
->getBulkOptions(),
'#empty_option' => $this
->t('- Select operation -'),
];
$form['operations']['apply_above'] = [
'#type' => 'submit',
'#value' => $this
->t('Apply to selected items'),
];
// Table select.
$form['items'] = $table;
$form['items']['#type'] = 'tableselect';
$form['items']['#options'] = $table['#rows'];
$form['apply_below'] = [
'#type' => 'submit',
'#value' => $this
->t('Apply to selected items'),
];
return $form;
}