protected function FileTypeForm::copyFormValuesToEntity in File Entity (fieldable files) 8.2
Copies top-level form values to entity properties
This should not change existing entity properties that are not being edited by this form.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity the current form should operate upon.
array $form: A nested array of form elements comprising the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides EntityForm::copyFormValuesToEntity
File
- src/
Form/ FileTypeForm.php, line 125
Class
- FileTypeForm
- Form controller for file type forms.
Namespace
Drupal\file_entity\FormCode
protected function copyFormValuesToEntity(EntityInterface $entity, array $form, FormStateInterface $form_state) {
// Convert multi-line string to array before copying.
// This may be called multiple times and exectued only if it is a string.
if (is_string($form_state
->getValue('mimetypes'))) {
$form_state
->setValue('mimetypes', explode("\n", str_replace("\r", "", $form_state
->getValue('mimetypes'))));
}
parent::copyFormValuesToEntity($entity, $form, $form_state);
}