public function CkeditorTemplateForm::validateForm in Ckeditor templates user interface 8
Form validation handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides FormBase::validateForm
File
- src/
Form/ CkeditorTemplateForm.php, line 114
Class
- CkeditorTemplateForm
- Implement config form for Ckeditor template.
Namespace
Drupal\ckeditor_templates_ui\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
parent::validateForm($form, $form_state);
// Check for a new uploaded image.
if (!$form_state
->getErrors()) {
$file = _file_save_upload_from_form($form['image_upload'], $form_state, 0);
if ($file) {
// Put the temporary file in form_values so we can save it on submit.
$form_state
->setValue('image_upload', $file);
}
}
}