FormTestTableSelectMultipleTrueForm.php in Zircon Profile 8
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;
class FormTestTableSelectMultipleTrueForm extends FormTestTableSelectFormBase {
public function getFormId() {
return '_form_test_tableselect_multiple_true_form';
}
public function buildForm(array $form, FormStateInterface $form_state) {
return $this
->tableselectFormBuilder($form, $form_state, array(
'#multiple' => TRUE,
));
}
public function submitForm(array &$form, FormStateInterface $form_state) {
$selected = $form_state
->getValue('tableselect');
foreach ($selected as $key => $value) {
drupal_set_message(t('Submitted: @key = @value', array(
'@key' => $key,
'@value' => $value,
)));
}
}
}