function taxonomy_taxonomy_vocabulary_presave

Implements hook_ENTITY_TYPE_presave().

File

core/modules/taxonomy/taxonomy.module, line 302

Code

function taxonomy_taxonomy_vocabulary_presave(VocabularyInterface $vocabulary) {
  // Vocabularies' `description` field must be stored as NULL at the config
  // level if it is empty.
  // @see taxonomy_post_update_set_vocabulary_description_to_null()
  if (trim($vocabulary->getDescription()) === '') {
    $vocabulary->set('description', NULL);
  }
}

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