You are here

protected function BulkEditForm::getForm in Views Bulk Edit 8

Gets the form for this entity display.

1 call to BulkEditForm::getForm()
BulkEditForm::buildForm in src/Form/BulkEditForm.php
Form constructor.

File

src/Form/BulkEditForm.php, line 93

Class

BulkEditForm
The bulk edit form.

Namespace

Drupal\views_bulk_edit\Form

Code

protected function getForm($entity_type_id, $bundle, $form, FormStateInterface $form_state) {
  $form[$bundle] = [
    '#type' => 'fieldset',
    '#tree' => TRUE,
    '#parents' => [
      $bundle,
    ],
    '#title' => $bundle,
  ];
  $entity_type = $this->entityTypeManager
    ->getDefinition($entity_type_id);
  $entity = $this->entityTypeManager
    ->getStorage($entity_type_id)
    ->create([
    $entity_type
      ->getKey('bundle') => $bundle,
  ]);
  $form_display = EntityFormDisplay::collectRenderDisplay($entity, 'bulk_edit');
  $form_display
    ->buildForm($entity, $form[$bundle], $form_state);
  $form_state
    ->set('form_display', $form_display);
  $form[$bundle] += $this
    ->getSelectorForm($bundle, $form[$bundle]);
  return $form;
}