function EntityDisplayModeFormBase::copyFormValuesToEntity

Overrides EntityForm::copyFormValuesToEntity

File

core/modules/field_ui/src/Form/EntityDisplayModeFormBase.php, line 305

Class

EntityDisplayModeFormBase
Provides the generic base class for entity display mode forms.

Namespace

Drupal\field_ui\Form

Code

protected function copyFormValuesToEntity(EntityInterface $entity, array $form, FormStateInterface $form_state) : void {
    // Config schema dictates that the description value
    // cannot be empty string. So, if it is empty, make it NULL.
    if ($form_state->hasValue('description') && trim($form_state->getValue('description')) === '') {
        $form_state->setValue('description', NULL);
    }
    parent::copyFormValuesToEntity($entity, $form, $form_state);
}

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