FileRequiredTestForm.php

Same filename in other branches
  1. 10 core/modules/file/tests/file_test/src/Form/FileRequiredTestForm.php
  2. 11.x core/modules/file/tests/file_test/src/Form/FileRequiredTestForm.php

Namespace

Drupal\file_test\Form

File

core/modules/file/tests/file_test/src/Form/FileRequiredTestForm.php

View source
<?php

namespace Drupal\file_test\Form;

use Drupal\Core\Form\FormStateInterface;

/**
 * File required test form class.
 */
class FileRequiredTestForm extends FileTestForm {
    
    /**
     * {@inheritdoc}
     */
    public function getFormId() {
        return '_file_required_test_form';
    }
    
    /**
     * {@inheritdoc}
     */
    public function buildForm(array $form, FormStateInterface $form_state) {
        $form = parent::buildForm($form, $form_state);
        $form['file_test_upload']['#required'] = TRUE;
        return $form;
    }

}

Classes

Title Deprecated Summary
FileRequiredTestForm File required test form class.

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