function node_update_8301

Set the 'published' entity key.

File

core/modules/node/node.install, line 242

Code

function node_update_8301() {
    $definition_update_manager = \Drupal::entityDefinitionUpdateManager();
    $entity_type = $definition_update_manager->getEntityType('node');
    $keys = $entity_type->getKeys();
    $keys['published'] = 'status';
    $entity_type->set('entity_keys', $keys);
    $definition_update_manager->updateEntityType($entity_type);
}

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