Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / system / tests / modules / form_test / src / Form / FormTestFormStateValuesCleanAdvancedForm.php
1 <?php
2
3 namespace Drupal\form_test\Form;
4
5 use Drupal\Core\Form\FormBase;
6 use Drupal\Core\Form\FormStateInterface;
7
8 /**
9  * Form builder for \Drupal\Core\Form\FormState::cleanValues() test.
10  *
11  * @internal
12  */
13 class FormTestFormStateValuesCleanAdvancedForm extends FormBase {
14
15   /**
16    * {@inheritdoc}
17    */
18   public function getFormId() {
19     return 'form_test_form_state_clean_values_advanced_form';
20   }
21
22   /**
23    * {@inheritdoc}
24    */
25   public function buildForm(array $form, FormStateInterface $form_state) {
26     // Build an example form containing a managed file and a submit form element.
27     $form['image'] = [
28       '#type' => 'managed_file',
29       '#title' => t('Image'),
30       '#upload_location' => 'public://',
31       '#default_value' => 0,
32     ];
33     $form['submit'] = [
34       '#type' => 'submit',
35       '#value' => t('Submit'),
36     ];
37     return $form;
38   }
39
40   /**
41    * {@inheritdoc}
42    */
43   public function submitForm(array &$form, FormStateInterface $form_state) {
44     $form_state->cleanValues();
45     print t('You WIN!');
46     exit;
47   }
48
49 }