function SystemHooks::systemEntityFormModePresave

Implements hook_entity_form_mode_presave().

Transforms empty description into null.

File

core/modules/system/src/Hook/SystemHooks.php, line 543

Class

SystemHooks
Hook implementations for system.

Namespace

Drupal\system\Hook

Code

public function systemEntityFormModePresave(EntityInterface $entity) : void {
    if ($entity->get('description') !== NULL && trim($entity->get('description')) === '') {
        @trigger_error("Setting description to an empty string is deprecated in drupal:11.2.0 and it must be null in drupal:12.0.0. See https://www.drupal.org/node/3452144", E_USER_DEPRECATED);
        $entity->set('description', NULL);
    }
}

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