function workspaces_update_8802

Add the 'parent' field to the 'workspace' entity type.

File

core/modules/workspaces/workspaces.install, line 169

Code

function workspaces_update_8802() {
  $entity_definition_update_manager = \Drupal::entityDefinitionUpdateManager();
  // Install the new 'parent' field.
  $storage_definition = BaseFieldDefinition::create('entity_reference')->setLabel(t('Parent'))
    ->setDescription(t('The parent workspace.'))
    ->setSetting('target_type', 'workspace')
    ->setReadOnly(TRUE);
  $entity_definition_update_manager->installFieldStorageDefinition('parent', 'workspace', 'workspaces', $storage_definition);
}

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