FormTestTableSelectMultipleTrueForm.php

Same filename in other branches
  1. 8.9.x core/modules/system/tests/modules/form_test/src/Form/FormTestTableSelectMultipleTrueForm.php
  2. 10 core/modules/system/tests/modules/form_test/src/Form/FormTestTableSelectMultipleTrueForm.php
  3. 11.x core/modules/system/tests/modules/form_test/src/Form/FormTestTableSelectMultipleTrueForm.php

Namespace

Drupal\form_test\Form

File

core/modules/system/tests/modules/form_test/src/Form/FormTestTableSelectMultipleTrueForm.php

View source
<?php

namespace Drupal\form_test\Form;

use Drupal\Core\Form\FormStateInterface;

/**
 * Builds a form to test table select with '#multiple' as TRUE.
 *
 * @internal
 */
class FormTestTableSelectMultipleTrueForm extends FormTestTableSelectFormBase {
    
    /**
     * {@inheritdoc}
     */
    public function getFormId() {
        return '_form_test_tableselect_multiple_true_form';
    }
    
    /**
     * {@inheritdoc}
     */
    public function buildForm(array $form, FormStateInterface $form_state) {
        return $this->tableselectFormBuilder($form, $form_state, [
            '#multiple' => TRUE,
        ]);
    }
    
    /**
     * {@inheritdoc}
     */
    public function submitForm(array &$form, FormStateInterface $form_state) {
        $selected = $form_state->getValue('tableselect');
        foreach ($selected as $key => $value) {
            $this->messenger()
                ->addStatus($this->t('Submitted: @key = @value', [
                '@key' => $key,
                '@value' => $value,
            ]));
        }
    }

}

Classes

Title Deprecated Summary
FormTestTableSelectMultipleTrueForm Builds a form to test table select with '#multiple' as TRUE.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.