You are here

public function BulkEditForm::buildForm in Views Bulk Edit 8.2

Same name and namespace in other branches
  1. 8 src/Form/BulkEditForm.php \Drupal\views_bulk_edit\Form\BulkEditForm::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 ConfirmFormBase::buildForm

File

src/Form/BulkEditForm.php, line 98

Class

BulkEditForm
The bulk edit form.

Namespace

Drupal\views_bulk_edit\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $bundle_data = [];
  foreach ($this
    ->getBulkEditEntityData() as $entity_type_id => $bundle_entities) {
    $bundle_info = $this->bundleInfo
      ->getBundleInfo($entity_type_id);
    foreach ($bundle_entities as $bundle => $entities) {
      $this->count += count($entities);
      $bundle_data[$entity_type_id][$bundle] = $bundle_info[$bundle]['label'];
    }
  }
  $form = $this
    ->buildBundleForms($form, $form_state, $bundle_data);
  $form = parent::buildForm($form, $form_state);
  return $form;
}